//~~tv:20010.20230630 //~~tc: Tealium Custom Container //~~tc: Updated Tealium loader to 4.35 version /* Tealium Custom Container Notes: - Add sending code between "Start Tag Sending Code" and "End Tag Sending Code". - Add JavaScript tag library code between "Start Tag Library Code" and "End Tag Library Code". - Add JavaScript code only, do not add HTML code in this file. - Remove any tags from the code you place in this file. Loading external JavaScript files (Loader): - If you need to load an additional external JavaScript file, un-comment the singe-line JavaScript comments ("//") within the following Loader sections near the bottom of this file: - "Start Loader Function Call" - "End Loader Function Call" - "Start Loader Callback Function" - "End Loader Callback Function" - After un-commenting, insert the path to the external JavaScript file you want to load. - Finally, within the Loader callback function, insert the JavaScript code that should run after the external JavaScript file has loaded. */ /* Start Tag Library Code */ /* End Tag Library Code */ //tealium universal tag - utag.sender.custom_container ut4.0.202508160121, Copyright 2025 Tealium.com Inc. All Rights Reserved. try { (function (id, loader) { var u = {}; utag.o[loader].sender[id] = u; // Please do not modify if (utag.ut === undefined) { utag.ut = {}; } // Start Tealium loader 4.35 if (utag.ut.loader === undefined) { u.loader = function (o) { var b, c, l, a = document; if (o.type === "iframe") { b = a.createElement("iframe"); o.attrs = o.attrs || { "height" : "1", "width" : "1", "style" : "display:none" }; for( l in utag.loader.GV(o.attrs) ){ b.setAttribute( l, o.attrs[l] ); } b.setAttribute("src", o.src); }else if (o.type=="img"){ utag.DB("Attach img: "+o.src); b=new Image();b.src=o.src; return; }else{ b = a.createElement("script");b.language="javascript";b.type="text/javascript";b.async=1;b.charset="utf-8"; for( l in utag.loader.GV(o.attrs) ){ b[l] = o.attrs[l]; } b.src = o.src; } if(o.id){b.id=o.id}; if (typeof o.cb=="function") { if(b.addEventListener) { b.addEventListener("load",function(){o.cb()},false); }else { /* old IE support */ b.onreadystatechange=function(){if(this.readyState=='complete'||this.readyState=='loaded'){this.onreadystatechange=null;o.cb()}}; } } l = o.loc || "head"; c = a.getElementsByTagName(l)[0]; if (c) { utag.DB("Attach to "+l+": "+o.src); if (l == "script") { c.parentNode.insertBefore(b, c); } else { c.appendChild(b) } } } } else { u.loader = utag.ut.loader; } // End Tealium loader u.ev = {view: 1}; u.initialized = false; u.map={}; u.extend=[function(a,b){ try{ if(1){ function handleAlloy() { (function() { window._satellite = window._satellite || {}; var _satellite = window._satellite; window._satellite.container = { "buildInfo": { "buildDate": "2025-07-25T14:48:05Z", "turbineBuildDate": "2024-08-22T17:32:44Z", "turbineVersion": "28.0.0" }, "environment": { "id": "EN436cad5320994d6c9de5a108aa0fffe1", "stage": "development" }, "dataElements": { "productOfferCode_params": { "modulePath": "core/src/lib/dataElements/customCode.js", "settings": { "source": function(event) { const productOfferCodeParams = [ 'productOfferCode_ddo', 'productOfferCode_query_param' ]; for (let param of productOfferCodeParams) { const value = _satellite.getVar(param); if (value) { return value; } } if(_satellite.getVar('campaign_query_param')){ return _satellite.getVar('campaign_query_param').split("~")[1]; } } } }, "keywords_internal_search_params": { "modulePath": "core/src/lib/dataElements/queryStringParameter.js", "settings": { "name": "keywords", "caseInsensitive": true } }, "finCenAssocId_QSP": { "modulePath": "core/src/lib/dataElements/queryStringParameter.js", "settings": { "name": "finCenAssocId", "caseInsensitive": true } }, "mboxName": { "defaultValue": "", "modulePath": "core/src/lib/dataElements/javascriptVariable.js", "settings": { "path": "digitalData.page.attributes.mbox.name" } }, "GSID": { "modulePath": "core/src/lib/dataElements/cookie.js", "settings": { "name": "GSID" } }, "XDM:Page Scroll 25Per": { "modulePath": "adobe-alloy/dist/lib/dataElements/xdmObject/index.js", "settings": { "data": { "web": { "webInteraction": { "name": "Page Scroll 25 Per ", "type": "other", "linkClicks": { "value": 1 } }, "webPageDetails": { "name": "%pageName%", "server": "%pageDomain%" } }, "_experience": { "analytics": { "event1to100": { "event48": { "value": 1 } }, "customDimensions": { "eVars": { "eVar1": "%pageURL%", "eVar25": "%pageName%", "eVar78": "%coreURL%", "eVar81": "%pageName%" }, "props": { "prop33": "%pageName%" } } } }, "identityMap": "%XDM:Identity Map%" }, "sandbox": { "name": "dev" } } }, "utm_content": { "modulePath": "core/src/lib/dataElements/queryStringParameter.js", "settings": { "name": "utm_content", "caseInsensitive": true } }, "cq_src_query_param": { "modulePath": "core/src/lib/dataElements/queryStringParameter.js", "settings": { "name": "cq_src", "caseInsensitive": true } }, "XDM:Video Ended": { "modulePath": "adobe-alloy/dist/lib/dataElements/xdmObject/index.js", "settings": { "data": { "web": { "webInteraction": { "name": "Video Ended", "type": "other", "linkClicks": { "value": 1 } }, "webPageDetails": { "name": "%pageName%", "server": "%pageDomain%" } }, "_experience": { "analytics": { "event1to100": { "event54": { "value": 1 } }, "customDimensions": { "eVars": { "eVar1": "%pageURL%", "eVar25": "%pageName%", "eVar68": "%videoID%", "eVar78": "%coreURL%", "eVar81": "%pageName%" }, "props": { "prop33": "%pageName%" } } } }, "identityMap": "%XDM:Identity Map%" }, "sandbox": { "name": "dev" } } }, "demandbase_company_name": { "defaultValue": "", "modulePath": "core/src/lib/dataElements/javascriptVariable.js", "settings": { "path": "digitalData.user.company.company_name" } }, "subCampaignCode": { "defaultValue": "", "cleanText": true, "modulePath": "core/src/lib/dataElements/javascriptVariable.js", "settings": { "path": "digitalData.page.attributes.subCampaignCode" } }, "chatcConversionStage": { "defaultValue": "", "modulePath": "core/src/lib/dataElements/javascriptVariable.js", "settings": { "path": "digitalData.page.attributes.chat.conversionstage" } }, "wordCount": { "defaultValue": "", "modulePath": "core/src/lib/dataElements/customCode.js", "settings": { "source": function(event) { if(digitalData.page.attributes.wordCount){ return digitalData.page.attributes.wordCount; } } } }, "customEvent-eventKey": { "modulePath": "gcoe-adobe-client-data-layer/src/lib/dataElements/datalayerComputedState.js", "settings": { "path": "eventKey" } }, "productListItem": { "modulePath": "core/src/lib/dataElements/customCode.js", "settings": { "source": function(event) { var prodViewProductListItem = []; if(digitalData){ if(digitalData.product){ for(i=0;i -1) return true; else return false; } } }, "audienceTags": { "defaultValue": "", "modulePath": "core/src/lib/dataElements/javascriptVariable.js", "settings": { "path": "digitalData.page.attributes.audienceTags" } }, "hashURL": { "modulePath": "core/src/lib/dataElements/customCode.js", "settings": { "source": function(event) { return document.location.hash; } } }, "utm_term": { "modulePath": "core/src/lib/dataElements/queryStringParameter.js", "settings": { "name": "utm_term", "caseInsensitive": true } }, "demandbase_employee_range": { "defaultValue": "", "modulePath": "core/src/lib/dataElements/javascriptVariable.js", "settings": { "path": "digitalData.user.company.employee_range" } }, "productCode_query_param": { "modulePath": "core/src/lib/dataElements/queryStringParameter.js", "settings": { "name": "productCode", "caseInsensitive": true } }, "cartproductName": { "defaultValue": "", "modulePath": "core/src/lib/dataElements/javascriptVariable.js", "settings": { "path": "digitalData.cart.item[0].productInfo.productName" } }, "applicationID": { "defaultValue": "", "modulePath": "core/src/lib/dataElements/javascriptVariable.js", "settings": { "path": "digitalData.applicationID" } }, "datastream": { "modulePath": "core/src/lib/dataElements/customCode.js", "settings": { "source": function(event) { if(utag_data.tealium_environment == 'prod'){ return "f45f4a2b-c94b-4b81-a49b-acd898ade560" } else { return "aa1aa0f9-222f-4dd0-829e-1573d2584e04" } } } }, "XDM: Custom Event": { "modulePath": "adobe-alloy/dist/lib/dataElements/xdmObject/index.js", "settings": { "data": { "web": { "webInteraction": { "name": "Custom Event", "type": "other", "linkClicks": { "value": 1 } } }, "_experience": { "analytics": { "customDimensions": { "eVars": { "eVar1": "%pageURL%", "eVar8": "%applicationLOB%", "eVar25": "%pageName%", "eVar78": "%coreURL%", "eVar81": "%pageName%", "eVar87": "%appName_params%", "eVar88": "%appStepNumber_params%", "eVar89": "%appStepName_params%", "eVar215": "%customEvent-merge%", "eVar227": "%USAApp%" }, "props": { "prop33": "%pageName%" } } } }, "identityMap": "%XDM:Identity Map%" }, "sandbox": { "name": "dev" } } }, "segmentValue": { "modulePath": "core/src/lib/dataElements/customCode.js", "settings": { "source": function(event) { var pageInfoKey = _satellite.getVar("pageInfoKey"); if(pageInfoKey != null || pageInfoKey != undefined){ if(digitalData.page.pageInfo[pageInfoKey].segmentValue != null){ return digitalData.page.pageInfo[pageInfoKey].segmentValue; } } else{ return ''; } } } }, "demandbase_sub_industry": { "defaultValue": "", "modulePath": "core/src/lib/dataElements/javascriptVariable.js", "settings": { "path": "digitalData.user.company.sub_industry" } }, "FPID_CLIENT_present": { "modulePath": "core/src/lib/dataElements/customCode.js", "settings": { "source": function(event) { if(_satellite.getVar('FPID_CLIENT') != undefined){ return 'true'; } else{ return 'false'; } } } }, "deviceType": { "modulePath": "core/src/lib/dataElements/customCode.js", "settings": { "source": function(event) { return 'browser'; } } }, "cartApplicationDecision": { "defaultValue": "", "modulePath": "core/src/lib/dataElements/javascriptVariable.js", "settings": { "path": "digitalData.cart.applicationDecision" } }, "tealium_profile": { "modulePath": "core/src/lib/dataElements/javascriptVariable.js", "settings": { "path": "utag_data.tealium_profile" } }, "mboxOrderTotal": { "defaultValue": "", "modulePath": "core/src/lib/dataElements/javascriptVariable.js", "settings": { "path": "digitalData.page.attributes.mbox.orderTotal" } }, "finCenAssocId_present": { "modulePath": "core/src/lib/dataElements/customCode.js", "settings": { "source": function(event) { if(_satellite.getVar('finCenAssocId_QSP') != undefined){ return 'true'; } else{ return 'false' } } } }, "cq_term_query_param ": { "modulePath": "core/src/lib/dataElements/queryStringParameter.js", "settings": { "name": "cq_term", "caseInsensitive": true } }, "demandbase_revenue_range": { "defaultValue": "", "modulePath": "core/src/lib/dataElements/javascriptVariable.js", "settings": { "path": "digitalData.user.company.revenue_range" } }, "XDM:Video 100Per": { "modulePath": "adobe-alloy/dist/lib/dataElements/xdmObject/index.js", "settings": { "data": { "web": { "webInteraction": { "name": "Video 100 Per ", "type": "other", "linkClicks": { "value": 1 } }, "webPageDetails": { "name": "%pageName%", "server": "%pageDomain%" } }, "_experience": { "analytics": { "event1to100": { "event43": { "value": 1 } }, "customDimensions": { "eVars": { "eVar1": "%pageURL%", "eVar25": "%pageName%", "eVar68": "%videoID%", "eVar78": "%coreURL%", "eVar81": "%pageName%" }, "props": { "prop33": "%pageName%" } } } }, "identityMap": "%XDM:Identity Map%" }, "sandbox": { "name": "dev" } } }, "XDM: Manual link Click": { "modulePath": "adobe-alloy/dist/lib/dataElements/xdmObject/index.js", "settings": { "data": { "web": { "webInteraction": { "name": "%webButtonLinkName_dyn%", "type": "other", "linkClicks": { "value": 1 } } }, "_experience": { "analytics": { "event1to100": { "event22": { "value": 1 } }, "customDimensions": { "eVars": { "eVar1": "%pageURL%", "eVar25": "%pageName%", "eVar78": "%coreURL%", "eVar81": "%pageName%", "eVar207": "%webButtonLinkName_dyn%", "eVar208": "%webButtonLinkURL_dyn%" }, "props": { "prop33": "%pageName%" } } } }, "identityMap": "%XDM:Identity Map%" }, "sandbox": { "name": "dev" } } }, "XDM:Pageview": { "modulePath": "adobe-alloy/dist/lib/dataElements/xdmObject/index.js", "settings": { "data": { "web": { "webPageDetails": { "name": "%pageName%", "server": "%pageDomain%", "pageViews": { "value": 1 }, "isErrorPage": "%errorPage%" } }, "marketing": { "trackingCode": "%trackingCode%" }, "_experience": { "analytics": { "event1to100": { "event6": { "value": "%sitePromotionClickthrough%" }, "event7": { "value": "%wordCountEvent%" }, "event8": { "value": "%fileSizeEvent%" }, "event10": { "value": "%productListing - event%" }, "event47": { "value": "%solutionFinderEvent%" } }, "customDimensions": { "eVars": { "eVar1": "%pageURL%", "eVar2": "%pageDomain%", "eVar3": "%pageQueryString%", "eVar7": "%coreURL%", "eVar8": "%applicationLOB%", "eVar9": "%guid%", "eVar10": "%MMID V2%", "eVar35": "%celebrusSessionID%", "eVar36": "%hostName%", "eVar37": "%pathName%", "eVar38": "%hashURL%", "eVar42": "%pageQueryString%", "eVar52": "%errorCode%", "eVar53": "%oaosource%", "eVar56": "%tealium_profile%", "eVar57": "%src_cd%", "eVar58": "%deviceType%", "eVar60": "%internal_search_params%", "eVar61": "%BA Consumer%", "eVar62": "%state%", "eVar63": "%CONTEXT%", "eVar64": "%INTL_LANG%", "eVar65": "%BOFA_LOCALE_COOKIE%", "eVar66": "%LANG_COOKIE%", "eVar71": "%user.segment%", "eVar72": "%user.state%", "eVar73": "%user.preferred_rewards_tier%", "eVar74": "%UserAuth_params%", "eVar76": "%userSegmentML%", "eVar78": "%coreURL%", "eVar81": "%pageName%", "eVar82": "%previouspage%", "eVar85": "%language%", "eVar86": "%segmentValue%", "eVar87": "%appName_params%", "eVar88": "%appStepNumber_params%", "eVar89": "%appStepName_params%", "eVar90": "%pagePrimaryCategory%", "eVar91": "%pageAddlCategory%", "eVar93": "%applicationID%", "eVar95": "%wordCount%", "eVar96": "%userType%", "eVar97": "%pageType%", "eVar98": "%primaryTopic%", "eVar100": "%chatSection%", "eVar101": "%chatSiteID%", "eVar102": "%chatPageType%", "eVar103": "%chatIpButtonDiv%", "eVar104": "%chatcConversionStage%", "eVar105": "%chatSubSection%", "eVar106": "%chatCustomerLOB%", "eVar107": "%audienceTags%", "eVar108": "%hasMedia%", "eVar109": "%primaryComponent%", "eVar110": "%fileSize%", "eVar111": "%productID%", "eVar112": "%productName%", "eVar121": "%subCampaignCode%", "eVar122": "%cartAttributesApplicationId%", "eVar123": "%sourceCode_params%", "eVar124": "%campaignId_params%", "eVar131": "%utm_source%", "eVar132": "%utm_medium%", "eVar133": "%utm_campaign%", "eVar134": "%utm_term%", "eVar135": "%utm_content%", "eVar136": "%GCLID%", "eVar137": "%GCLSRC%", "eVar138": "%DCLID%", "eVar139": "%FBCLID%", "eVar140": "%demandbase_annual_sales%", "eVar141": "%demandbase_audience%", "eVar142": "%demandbase_audience_segment%", "eVar143": "%demandbase_city%", "eVar144": "%demandbase_company_name%", "eVar145": "%demandbase_country_name%", "eVar146": "%demandbase_sid%", "eVar147": "%demandbase_employee_count%", "eVar148": "%demandbase_employee_range%", "eVar149": "%demandbase_hq_company_name%", "eVar150": "%demandbase_hq_industry%", "eVar151": "%demandbase_industry%", "eVar152": "%demandbase_revenue_range%", "eVar153": "%demandbase_state%", "eVar154": "%demandbase_stock_ticker%", "eVar155": "%demandbase_sub_industry%", "eVar156": "%demandbase_watch_list_aw_parent_company%", "eVar157": "%demandbase_watch_list_campaign_code%", "eVar158": "%demandbase_watch_list_source_company%", "eVar159": "%demandbase_website%", "eVar160": "%cq_src_query_param%", "eVar161": "%cq_cmp_query_param%", "eVar162": "%cq_term_query_param %", "eVar163": "%celebruspersisted%", "eVar164": "%celebrusContentKey%", "eVar165": "%BOAGeographicData%", "eVar166": "%GSID%", "eVar171": "%cartApplicationID%", "eVar172": "%sentinelCookie%", "eVar173": "%mboxName%", "eVar174": "%mboxDecision%", "eVar175": "%mboxOrderID%", "eVar176": "%mboxOrderTotal%", "eVar177": "%mboxProductPurchasedId%", "eVar178": "%mboxCreateParam%", "eVar181": "%cartAttributesStatus%", "eVar182": "%productOfferCode_params%", "eVar183": "%lastPageNameFromHistory%", "eVar184": "%appStepNameAndNumberFromHistory%", "eVar185": "%cartFulfilmentID%", "eVar186": "%cartprimaryCategory%", "eVar187": "%cartproductName%", "eVar188": "%cartproductID%", "eVar189": "%OptanonConsent%", "eVar190": "%user.youthFlag%", "eVar191": "%privacyFlagFromCookie%", "eVar192": "%isSBCustomer%", "eVar193": "%chatMobileIndicator%", "eVar194": "%chatAuthenticated%", "eVar195": "%chatAccountType%", "eVar196": "%chatLoanType%", "eVar197": "%chatProductType%", "eVar198": "%chatMLD_OAO_ACCOUNTNUMBER%", "eVar199": "%chatMLD_OAO_CONFIRMATIONNUMBER%", "eVar200": "%chatInqSalesQuantities%", "eVar201": "%chatInqClientOrderNum%", "eVar202": "%chatInqOrderType%", "eVar203": "%chatInqSalesProducts%", "eVar204": "%chatNumber_Of_Checking_Accounts%", "eVar205": "%chatNumber_Of_Other_Accounts%", "eVar206": "%chatNumber_Of_Regular_Savings_Accounts%", "eVar211": "%PageTitle%", "eVar212": "%campaign_query_param%", "eVar214": "%orderID%", "eVar217": "%applicationID_params%", "eVar218": "%applicationDecision_params%", "eVar219": "%sourceid_query_param%", "eVar220": "%subChannel_query_param%", "eVar221": "%prodType_query_param%", "eVar222": "%marketingCode_query_param%", "eVar223": "%prstat_query_param%", "eVar224": "%sgm_query_param%", "eVar225": "%productCode_query_param%", "eVar226": "%Deer%", "eVar227": "%USAApp%", "eVar228": "%Bear%" }, "props": { "prop1": "%pageURL%", "prop2": "%pageDomain%", "prop3": "%pageQueryString%", "prop36": "%hostName%", "prop37": "%pathName%", "prop38": "%hashURL%", "prop42": "%pageQueryString%", "prop47": "%solutionFinder%", "prop50": "%pageID fallback%", "prop52": "%finCenAssocId_present%", "prop53": "%FPID_CLIENT_present%" } } } }, "identityMap": "%XDM:Identity Map%", "productListItems": "%productListItem%" }, "sandbox": { "name": "prod" } } }, "GCLSRC": { "modulePath": "core/src/lib/dataElements/queryStringParameter.js", "settings": { "name": "GCLSRC", "caseInsensitive": true } }, "demandbase_website": { "defaultValue": "", "modulePath": "core/src/lib/dataElements/javascriptVariable.js", "settings": { "path": "digitalData.user.company.website" } }, "demandbase_watch_list_campaign_code": { "defaultValue": "", "modulePath": "core/src/lib/dataElements/javascriptVariable.js", "settings": { "path": "digitalData.user.company.watch_list_campaign_code" } }, "pageName": { "modulePath": "core/src/lib/dataElements/customCode.js", "settings": { "source": function(event) { var pageInfoKey = _satellite.getVar("pageInfoKey"); if ( (typeof pageInfoKey !== 'undefined' || pageInfoKey != null) && typeof digitalData !== "undefined" && digitalData.page && digitalData.page.pageInfo && digitalData.page.pageInfo[pageInfoKey] && digitalData.page.pageInfo[pageInfoKey].pageID ) { return digitalData.page.pageInfo[pageInfoKey].pageID; } else { return document.title; } } } }, "sfb": { "defaultValue": "", "modulePath": "core/src/lib/dataElements/queryStringParameter.js", "settings": { "name": "sfb", "caseInsensitive": true } }, "manualLinkClick-href": { "modulePath": "gcoe-adobe-client-data-layer/src/lib/dataElements/datalayerComputedState.js", "settings": { "path": "href" } }, "XDM: Conversion": { "modulePath": "adobe-alloy/dist/lib/dataElements/xdmObject/index.js", "settings": { "data": { "web": { "webInteraction": { "name": "%conversion-eventName%", "type": "other", "linkClicks": { "value": 1 } } }, "_experience": { "analytics": { "event1to100": { "event55": { "value": 1 } }, "customDimensions": { "eVars": { "eVar1": "%pageURL%", "eVar25": "%pageName%", "eVar78": "%coreURL%", "eVar81": "%pageName%", "eVar209": "%conversion-actionType%", "eVar210": "%conversion-eventName%" }, "props": { "prop33": "%pageName%" } } } }, "identityMap": "%XDM:Identity Map%" }, "sandbox": { "name": "dev" } } }, "appStepNameAndNumberFromHistory": { "modulePath": "core/src/lib/dataElements/customCode.js", "settings": { "source": function(event) { var pageViewHistory = []; var appStepNameAndNumber = ''; if(digitalData.page.attributes.pageIDHistory) { for(i=0;i -1){ appStepNameAndNumber= digitalData.page.attributes.pageIDHistory[i].pageID.split(':')[2] } pageViewHistory.push(appStepNameAndNumber); } } } return pageViewHistory.join('-_-') ; } } }, "pagePrimaryCategory": { "defaultValue": "", "modulePath": "core/src/lib/dataElements/javascriptVariable.js", "settings": { "path": "digitalData.page.category.primaryCategory" } }, "searchString ": { "defaultValue": "", "modulePath": "core/src/lib/dataElements/javascriptVariable.js", "settings": { "path": "digitalData.page.pageInfo.attributes.searchString" } }, "XDM: Workbook Custom Events": { "modulePath": "adobe-alloy/dist/lib/dataElements/xdmObject/index.js", "settings": { "data": { "web": { "webInteraction": { "name": "Workbook Custom Events", "type": "other", "linkClicks": { "value": 1 } } }, "_experience": { "analytics": { "customDimensions": { "eVars": { "eVar1": "%event.detail.URL%", "eVar25": "%event.detail.PageID%", "eVar78": "%coreURL%", "eVar81": "%event.detail.PageID%", "eVar167": "%event.detail.category%", "eVar168": "%event.detail.action%", "eVar169": "%event.detail.label%" }, "props": { "prop33": "%event.detail.PageID%" } } } }, "identityMap": "%XDM:Identity Map%" }, "sandbox": { "name": "dev" } } }, "cartprimaryCategory": { "defaultValue": "", "modulePath": "core/src/lib/dataElements/javascriptVariable.js", "settings": { "path": "digitalData.cart.item[0].category.primaryCategory" } }, "internalCampaign": { "modulePath": "core/src/lib/dataElements/queryStringParameter.js", "settings": { "name": "cm_sp", "caseInsensitive": true } }, "mboxCreateParam": { "modulePath": "core/src/lib/dataElements/customCode.js", "settings": { "source": function(event) { var pageInfoKey = _satellite.getVar("pageInfoKey"); if(pageInfoKey != null || pageInfoKey != undefined){ return digitalData.page.pageInfo[pageInfoKey].mboxCreateParam; } } } }, "appStepNumber": { "defaultValue": "", "modulePath": "core/src/lib/dataElements/customCode.js", "settings": { "source": function(event) { var pageInfoKey = _satellite.getVar("pageInfoKey"); if(pageInfoKey != null || pageInfoKey != undefined){ if(digitalData.page.pageInfo[pageInfoKey].appStepNumber != null){ return digitalData.page.pageInfo[pageInfoKey].appStepNumber; } } else{ return ''; } } } }, "chatInqSalesProducts": { "defaultValue": "", "modulePath": "core/src/lib/dataElements/javascriptVariable.js", "settings": { "path": "digitalData.page.attributes.chat.inqSalesProducts" } }, "productOfferCode_ddo": { "defaultValue": "", "modulePath": "core/src/lib/dataElements/javascriptVariable.js", "settings": { "path": "digitalData.cart.attributes.poCode" } }, "load_adobetarget": { "modulePath": "core/src/lib/dataElements/javascriptVariable.js", "settings": { "path": "utag_data.load_adobetarget" } }, "XDM:Video 25Per": { "modulePath": "adobe-alloy/dist/lib/dataElements/xdmObject/index.js", "settings": { "data": { "web": { "webInteraction": { "name": "Video 25 Per ", "type": "other", "linkClicks": { "value": 1 } }, "webPageDetails": { "name": "%pageName%", "server": "%pageDomain%" } }, "_experience": { "analytics": { "event1to100": { "event40": { "value": 1 } }, "customDimensions": { "eVars": { "eVar1": "%pageURL%", "eVar25": "%pageName%", "eVar68": "%videoID%", "eVar78": "%coreURL%", "eVar81": "%pageName%" }, "props": { "prop33": "%pageName%" } } } }, "identityMap": "%XDM:Identity Map%" }, "sandbox": { "name": "dev" } } }, "sourceCode_params": { "modulePath": "core/src/lib/dataElements/customCode.js", "settings": { "source": function(event) { const decisionParams = [ 'sourceCode', 'EcloSourceCode' ]; for (let param of decisionParams) { const value = _satellite.getVar(param); if (value) { return value; } } } } }, "customEvent-description": { "modulePath": "gcoe-adobe-client-data-layer/src/lib/dataElements/datalayerComputedState.js", "settings": { "path": "options.description" } }, "demandbase_state": { "defaultValue": "", "modulePath": "core/src/lib/dataElements/javascriptVariable.js", "settings": { "path": "digitalData.user.company.state" } }, "campaignId_ddo": { "defaultValue": "", "modulePath": "core/src/lib/dataElements/javascriptVariable.js", "settings": { "path": "digitalData.cart.attributes.campaignId" } }, "productListing - event": { "modulePath": "core/src/lib/dataElements/customCode.js", "settings": { "source": function(event) { if(_satellite.getVar('productListItem')){ if(_satellite.getVar('productListItem').length > 1){ return 1; } } else{ return undefined; } } } }, "fileSize": { "defaultValue": "", "modulePath": "core/src/lib/dataElements/customCode.js", "settings": { "source": function(event) { if(digitalData.page.attributes.fileSize){ return digitalData.page.attributes.fileSize; } } } }, "pageID fallback": { "modulePath": "core/src/lib/dataElements/customCode.js", "settings": { "source": function(event) { var pageInfoKey = _satellite.getVar("pageInfoKey"); if ( (typeof pageInfoKey !== 'undefined' && pageInfoKey != null) && // Check if pageInfoKey is defined and not null typeof digitalData !== "undefined" && // Check if digitalData is defined digitalData.page && digitalData.page.pageInfo && digitalData.page.pageInfo[pageInfoKey] && digitalData.page.pageInfo[pageInfoKey].pageID ) { return "PageID found"; } else if (typeof digitalData === "undefined") { return "DDO not loaded, default to document.title"; } else if (digitalData && !digitalData.page){ return "DDO found, no page Object"; } else if(digitalData && digitalData.page && digitalData.page.pageInfo.length == 0 ){ return "DDO found, page Object found, no pageInfo Object"; } else if(digitalData && digitalData.page && !digitalData.page.pageInfo[pageInfoKey].pageID) { return "DDO found, no pageID, default to document.title"; } else { return "default"; //catch all } } } }, "chatCustomerLOB": { "defaultValue": "", "modulePath": "core/src/lib/dataElements/javascriptVariable.js", "settings": { "path": "digitalData. page.attributes.chat.customer_lob" } }, "solutionFinderEvent": { "modulePath": "core/src/lib/dataElements/customCode.js", "settings": { "source": function(event) { if(_satellite.getVar('solutionFinder') != ''){ return 1; } else{ return 0; } } } }, "productName": { "defaultValue": "", "modulePath": "core/src/lib/dataElements/javascriptVariable.js", "settings": { "path": "digitalData.product.productInfo.productName" } }, "FPID_CLIENT": { "modulePath": "core/src/lib/dataElements/cookie.js", "settings": { "name": "FPID_CLIENT" } }, "chatSection": { "defaultValue": "", "modulePath": "core/src/lib/dataElements/javascriptVariable.js", "settings": { "path": "digitalData.page.attributes.chat.section" } }, "hasMedia": { "defaultValue": "", "modulePath": "core/src/lib/dataElements/javascriptVariable.js", "settings": { "path": "digitalData.page.attributes.hasMedia" } }, "demandbase_country_name": { "defaultValue": "", "modulePath": "core/src/lib/dataElements/javascriptVariable.js", "settings": { "path": "digitalData.user.company.country_name" } }, "pageDomain": { "modulePath": "core/src/lib/dataElements/customCode.js", "settings": { "source": function(event) { return document.location.host; } } }, "XDM: web button link Click": { "modulePath": "adobe-alloy/dist/lib/dataElements/xdmObject/index.js", "settings": { "data": { "web": { "webInteraction": { "name": "%webButtonLinkName_dyn%", "type": "other", "linkClicks": { "value": 1 } } }, "_experience": { "analytics": { "event1to100": { "event22": { "value": 1 } }, "customDimensions": { "eVars": { "eVar1": "%pageURL%", "eVar25": "%pageName%", "eVar49": "%webButtonLinkName_dyn%", "eVar50": "%webButtonLinkURL_dyn%", "eVar78": "%coreURL%", "eVar81": "%pageName%", "eVar99": "%webButtonbactmln_dyn%", "eVar211": "%PageTitle%" }, "props": { "prop33": "%pageName%", "prop51": "%pageID fallback%" } } } }, "identityMap": "%XDM:Identity Map%" }, "sandbox": { "name": "dev" } } }, "LANG_COOKIE": { "modulePath": "core/src/lib/dataElements/cookie.js", "settings": { "name": "LANG_COOKIE" } }, "subChannel_query_param": { "modulePath": "core/src/lib/dataElements/queryStringParameter.js", "settings": { "name": "subChannel", "caseInsensitive": true } }, "chatAuthenticated": { "defaultValue": "", "modulePath": "core/src/lib/dataElements/javascriptVariable.js", "settings": { "path": "digitalData.page.attributes.chat.AUTHENTICATED" } }, "cartproductID": { "defaultValue": "", "modulePath": "core/src/lib/dataElements/javascriptVariable.js", "settings": { "path": "digitalData.cart.item[0].productInfo.productID" } }, "demandbase_hq_company_name": { "defaultValue": "", "modulePath": "core/src/lib/dataElements/javascriptVariable.js", "settings": { "path": "digitalData.user.company.hq_company_name" } }, "user.segment": { "defaultValue": "", "modulePath": "core/src/lib/dataElements/javascriptVariable.js", "settings": { "path": "digitalData.user.segment" } }, "productOfferCode_query_param": { "modulePath": "core/src/lib/dataElements/customCode.js", "settings": { "source": function(event) { var url = window.location.href; if(url.indexOf('#') > -1 && url.indexOf('productOfferCode') > -1){ const hash = url.split('#')[1]; const queryString = hash.split('?')[1]; // Parse query parameters const params = new URLSearchParams(queryString); const productOfferCode = params.get('productOfferCode'); return productOfferCode; } else if(url.indexOf('productOfferCode') > -1){ const params = new URL(url).searchParams; const productOfferCode = params.get('productOfferCode'); return productOfferCode; } } } }, "sourceCode": { "defaultValue": "", "modulePath": "core/src/lib/dataElements/javascriptVariable.js", "settings": { "path": "digitalData.cart.attributes.sourceCode" } }, "nonce": { "modulePath": "core/src/lib/dataElements/customCode.js", "settings": { "source": function(event) { return 'rAnd0m'; } } }, "sfrr": { "defaultValue": "", "modulePath": "core/src/lib/dataElements/queryStringParameter.js", "settings": { "name": "sfrr", "caseInsensitive": true } }, "campaignId_params": { "modulePath": "core/src/lib/dataElements/customCode.js", "settings": { "source": function(event) { const campaignIdParams = [ 'campaignId_ddo', 'campaignId_query_param', 'EcloCampaignId' ]; for (let param of campaignIdParams) { const value = _satellite.getVar(param); if (value) { return value; } } if(_satellite.getVar('campaign_query_param')){ return _satellite.getVar('campaign_query_param').split("~")[0]; } } } }, "Deer": { "modulePath": "core/src/lib/dataElements/cookie.js", "settings": { "name": "Deer" } }, "demandbase_audience_segment": { "defaultValue": "", "modulePath": "core/src/lib/dataElements/javascriptVariable.js", "settings": { "path": "digitalData.user.company.audience_segment" } }, "pageInfoKey": { "modulePath": "core/src/lib/dataElements/customCode.js", "settings": { "source": function(event) { /** * Returns the pageInfoKey. */ var _getPageInfoKey = function (){ var pv = dataCollector.filter(function(d) { return d.event === 'pageview' }); if(pv.length === 1 && (typeof pv[pv.length - 1].pageInfoKey === 'undefined' || pv[pv.length - 1].pageInfoKey === null)) { return 0; } else { return pv[pv.length - 1]?.pageInfoKey; } } return _getPageInfoKey(); } } }, "XDM:Cart View": { "modulePath": "adobe-alloy/dist/lib/dataElements/xdmObject/index.js", "settings": { "data": { "web": { "webInteraction": { "name": "Cart View", "type": "other", "linkClicks": { "value": 1 } }, "webPageDetails": { "name": "%pageName%", "server": "%pageDomain%" } }, "commerce": { "productListViews": { "value": 1 } }, "_experience": { "analytics": { "customDimensions": { "eVars": { "eVar1": "%pageURL%", "eVar8": "%applicationLOB%", "eVar25": "%pageName%", "eVar78": "%coreURL%", "eVar81": "%pageName%", "eVar123": "%sourceCode_params%", "eVar124": "%campaignId_params%", "eVar211": "%PageTitle%", "eVar227": "%USAApp%" }, "props": { "prop33": "%pageName%", "prop51": "%pageID fallback%" } } } }, "identityMap": "%XDM:Identity Map%", "productListItems": "%cartviewPLI%" }, "sandbox": { "name": "dev" } } }, "utm_medium": { "modulePath": "core/src/lib/dataElements/queryStringParameter.js", "settings": { "name": "utm_medium", "caseInsensitive": true } }, "tealium_environment": { "modulePath": "core/src/lib/dataElements/javascriptVariable.js", "settings": { "path": "utag_data.tealium_environment" } }, "Bear": { "modulePath": "core/src/lib/dataElements/cookie.js", "settings": { "name": "Bear" } }, "cartApplicationID": { "defaultValue": "", "modulePath": "core/src/lib/dataElements/javascriptVariable.js", "settings": { "path": "digitalData.cart.applicationID" } }, "EcloAppStepName": { "modulePath": "core/src/lib/dataElements/javascriptVariable.js", "settings": { "path": "cm.appStepName" } }, "src_cd": { "modulePath": "core/src/lib/dataElements/queryStringParameter.js", "settings": { "name": "src_cd", "caseInsensitive": true } }, "XDM:Ad link Click": { "modulePath": "adobe-alloy/dist/lib/dataElements/xdmObject/index.js", "settings": { "data": { "web": { "webInteraction": { "name": "%coidName%", "type": "other", "linkClicks": { "value": 1 } }, "webPageDetails": { "name": "%pageName%", "server": "%pageDomain%" } }, "_experience": { "analytics": { "event1to100": { "event21": { "value": 1 } }, "customDimensions": { "eVars": { "eVar1": "%pageURL%", "eVar25": "%pageName%", "eVar47": "%coidName%", "eVar48": "%ad_url%", "eVar78": "%coreURL%", "eVar81": "%pageName%", "eVar211": "%PageTitle%" }, "props": { "prop33": "%pageName%", "prop51": "%pageID fallback%" } } } }, "identityMap": "%XDM:Identity Map%" }, "sandbox": { "name": "dev" } } }, "BA Consumer": { "modulePath": "core/src/lib/dataElements/cookie.js", "settings": { "name": "BA_0021" } }, "XDM:Page Scroll 100Per": { "modulePath": "adobe-alloy/dist/lib/dataElements/xdmObject/index.js", "settings": { "data": { "web": { "webInteraction": { "name": "Page Scroll 100 Per ", "type": "other", "linkClicks": { "value": 1 } }, "webPageDetails": { "name": "%pageName%", "server": "%pageDomain%" } }, "_experience": { "analytics": { "event1to100": { "event51": { "value": 1 } }, "customDimensions": { "eVars": { "eVar1": "%pageURL%", "eVar25": "%pageName%", "eVar78": "%coreURL%", "eVar81": "%pageName%" }, "props": { "prop33": "%pageName%" } } } }, "identityMap": "%XDM:Identity Map%" }, "sandbox": { "name": "dev" } } }, "prodview - event": { "modulePath": "core/src/lib/dataElements/customCode.js", "settings": { "source": function(event) { if(_satellite.getVar('productListItem') != undefined){ if(_satellite.getVar('productListItem').length == 1){ return 1; } } else{ return undefined; } } } }, "XDM:Page Scroll 75Per": { "modulePath": "adobe-alloy/dist/lib/dataElements/xdmObject/index.js", "settings": { "data": { "web": { "webInteraction": { "name": "Page Scroll 75 Per ", "type": "other", "linkClicks": { "value": 1 } }, "webPageDetails": { "name": "%pageName%", "server": "%pageDomain%" } }, "_experience": { "analytics": { "event1to100": { "event50": { "value": 1 } }, "customDimensions": { "eVars": { "eVar1": "%pageURL%", "eVar25": "%pageName%", "eVar78": "%coreURL%", "eVar81": "%pageName%" }, "props": { "prop33": "%pageName%" } } } }, "identityMap": "%XDM:Identity Map%" }, "sandbox": { "name": "dev" } } }, "k_internal_search_params": { "modulePath": "core/src/lib/dataElements/queryStringParameter.js", "settings": { "name": "k", "caseInsensitive": true } }, "is_globalmbox_allowlisted": { "modulePath": "core/src/lib/dataElements/customCode.js", "settings": { "source": function(event) { //List of domains that are allowed to fire the target-global-mbox aka Global mbox allowlist const globalmbox_allowlist = [ "about.bankofamerica.com", "www.about.bankofamerica.com", "bettermoneyhabits.bankofamerica.com", "www.bettermoneyhabits.bankofamerica.com", "careers.bankofamerica.com", "www.careers.bankofamerica.com", "locators.bankofamerica.com", "www.locators.bankofamerica.com", "promo.bankofamerica.com", "www.promo.bankofamerica.com", "promotions.bankofamerica.com", "www.promotions.bankofamerica.com", "info.bankofamerica.com", "www.info.bankofamerica.com", "business.bofa.com", "www.business.bofa.com", "business.bankofamerica.com", "www.business.bankofamerica.com", "www.ml.com", "ml.com", "www.merrilledge.com", "merrilledge.com", "www.merrill.com", "merrill.com", "www.pbig.ml.com", "pbig.ml.com", "privatebank.bankofamerica.com", "www.privatebank.bankofamerica.com", "auth.privatebank.bankofamerica.com", "www.auth.privatebank.bankofamerica.com", "olui2.fs.ml.com", "www.olui2.fs.ml.com", "oaui.fs.ml.com", "www.oaui.fs.ml.com", "secure.bankofamerica.com", "www.secure.bankofamerica.com", "institute.bankofamerica.com", "www.institute.bankofamerica.com", "investor.bankofamerica.com", "www.investor.bankofamerica.com", "advisor.ml.com", "www.advisor.ml.com", "www.bankofamerica.com", "bankofamerica.com" ]; //Exclude the Consumer and Business Homepages if (globalmbox_allowlist.includes(window.location.hostname) && window.location.href != "https://www.bankofamerica.com/") return true; else return false; } } }, "XDM:Video 50Per": { "modulePath": "adobe-alloy/dist/lib/dataElements/xdmObject/index.js", "settings": { "data": { "web": { "webInteraction": { "name": "Video 50 Per ", "type": "other", "linkClicks": { "value": 1 } }, "webPageDetails": { "name": "%pageName%", "server": "%pageDomain%" } }, "_experience": { "analytics": { "event1to100": { "event41": { "value": 1 } }, "customDimensions": { "eVars": { "eVar1": "%pageURL%", "eVar25": "%pageName%", "eVar68": "%videoID%", "eVar78": "%coreURL%", "eVar81": "%pageName%" }, "props": { "prop33": "%pageName%" } } } }, "identityMap": "%XDM:Identity Map%" }, "sandbox": { "name": "dev" } } }, "applicationID_params": { "modulePath": "core/src/lib/dataElements/customCode.js", "settings": { "source": function(event) { const appParams = [ 'cartApplicationID', 'cartAttributesApplicationId', 'applicationID' ]; for (let param of appParams) { const value = _satellite.getVar(param); if (value) { return value; } } } } }, "demandbase_industry": { "defaultValue": "", "modulePath": "core/src/lib/dataElements/javascriptVariable.js", "settings": { "path": "digitalData.user.company.industry" } }, "customError-merge": { "modulePath": "core/src/lib/dataElements/customCode.js", "settings": { "source": function(event) { return _satellite.getVar('customError-code')+"-_-"+_satellite.getVar('customError-errorMessage'); } } }, "primaryTopic": { "defaultValue": "", "modulePath": "core/src/lib/dataElements/javascriptVariable.js", "settings": { "path": "digitalData.page.attributes.primaryTopic" } }, "targetParams": { "modulePath": "core/src/lib/dataElements/customCode.js", "settings": { "source": function(event) { var data = {"__adobe": { "target": {} } }; var dataExists = false; //6 targetParam values can be defined for SPAs for(var i = 0; i < 6; i ++){ var j = i + 1; if(localStorage.getItem("targetParam" + j) != null){ data.__adobe.target["targetParam" + j] = JSON.parse(localStorage.getItem("targetParam" + j)); dataExists = true; } } if(digitalData.entity){ data.__adobe.target["entity.id"] = digitalData.entity.id; data.__adobe.target["entity.categoryId"] = digitalData.entity.categoryId; dataExists = true; } if(_satellite.getVar("isSBCustomer")){ data.__adobe.target["profile.isSBCustomer"] = true; dataExists = true; } if(dataExists) return data; } } }, "sfp": { "defaultValue": "", "modulePath": "core/src/lib/dataElements/queryStringParameter.js", "settings": { "name": "sfp", "caseInsensitive": true } }, "pathName": { "modulePath": "core/src/lib/dataElements/customCode.js", "settings": { "source": function(event) { return document.location.pathname; } } }, "customError-errorMessage": { "modulePath": "gcoe-adobe-client-data-layer/src/lib/dataElements/datalayerComputedState.js", "settings": { "path": "errorMessage" } }, "USAApp": { "modulePath": "core/src/lib/dataElements/customCode.js", "settings": { "source": function(event) { var alloyAppType=''; if(_satellite.getVar("pageName")){ var alloypageName = _satellite.getVar("pageName").toLowerCase(); if (alloypageName.startsWith("olb:app:usa_")) { alloyAppType = "USA App"; } } return alloyAppType; } } }, "chatNumber_Of_Regular_Savings_Accounts": { "defaultValue": "", "modulePath": "core/src/lib/dataElements/javascriptVariable.js", "settings": { "path": "digitalData.page.attributes.chat.Number_Of_Regular_Savings_Accounts" } }, "Target:Identity Map": { "modulePath": "core/src/lib/dataElements/customCode.js", "settings": { "source": function(event) { var identityMap = { "identityMap" : _satellite.getVar("XDM:Identity Map") } return identityMap; } } }, "primaryComponent": { "defaultValue": "", "modulePath": "core/src/lib/dataElements/javascriptVariable.js", "settings": { "path": "digitalData.page.attributes.primaryComponent" } }, "demandbase_hq_industry": { "defaultValue": "", "modulePath": "core/src/lib/dataElements/javascriptVariable.js", "settings": { "path": "digitalData.user.company.hq_industry" } }, "sentinelCookie": { "modulePath": "core/src/lib/dataElements/cookie.js", "settings": { "name": "BOA_0020" } }, "campaign_query_param": { "modulePath": "core/src/lib/dataElements/queryStringParameter.js", "settings": { "name": "campaign", "caseInsensitive": true } }, "appStepName": { "defaultValue": "", "modulePath": "core/src/lib/dataElements/customCode.js", "settings": { "source": function(event) { var pageInfoKey = _satellite.getVar("pageInfoKey"); if(pageInfoKey != null || pageInfoKey != undefined){ if(digitalData.page.pageInfo[pageInfoKey].appStepName != null){ return digitalData.page.pageInfo[pageInfoKey].appStepName; } } else{ return ''; } } } }, "XDM:Page Scroll 50Per": { "modulePath": "adobe-alloy/dist/lib/dataElements/xdmObject/index.js", "settings": { "data": { "web": { "webInteraction": { "name": "Page Scroll 50 Per ", "type": "other", "linkClicks": { "value": 1 } }, "webPageDetails": { "name": "%pageName%", "server": "%pageDomain%" } }, "_experience": { "analytics": { "event1to100": { "event49": { "value": 1 } }, "customDimensions": { "eVars": { "eVar1": "%pageURL%", "eVar25": "%pageName%", "eVar78": "%coreURL%", "eVar81": "%pageName%" }, "props": { "prop33": "%pageName%" } } } }, "identityMap": "%XDM:Identity Map%" }, "sandbox": { "name": "dev" } } }, "mboxOrderID": { "defaultValue": "", "modulePath": "core/src/lib/dataElements/javascriptVariable.js", "settings": { "path": "digitalData.page.attributes.mbox.orderId" } }, "coreURL": { "modulePath": "core/src/lib/dataElements/customCode.js", "settings": { "source": function(event) { hostName = document.location.hostname; pathName = document.location.pathname; return hostName+pathName; } } }, "at_property": { "modulePath": "core/src/lib/dataElements/customCode.js", "settings": { "source": function(event) { //List of at_property values const about = '65030af7-11c5-02df-d659-d3ba974f5f1c'; const bmh = 'fb007125-eef1-281e-8685-dcb7ff50f896'; const careersSite = 'b7880439-5d61-ead1-492c-07fb10cc8684'; const fia = '1a8d0183-947a-8fa5-52e5-2b3fc472e468'; const landingPages = '8a80ea05-e1a4-2d7a-0751-980f4c503943'; const locatorPages = '0da121b1-53b6-a39d-87b8-8d490eaf93e3'; const ml = '2c28efc5-fc52-2eba-d89f-6f09359d852c'; const mlAuth = '06c1c7a7-a8db-68a8-f76a-8274f0b455f3'; const olbAuth = '03954bbd-7b79-cffb-a9af-078d9bf4b095'; const unauthBAC = '338dacae-1da7-d420-f22c-0af26820a52f'; var atProperty = ''; var hdomain = window.location.host; //Helper method to use at_property set using at.js - remove post migration if(typeof targetPageParams != 'undefined'){ atProperty = targetPageParams().at_property; return atProperty; } //Set property based on Tealium profile or domain if(atProperty == ''){ //unauthBAC Homepage if(hdomain.startsWith('www.bankofamerica.com')){ atProperty = unauthBAC; } //unauthBAC Homepage LLEs if((hdomain.indexOf('dev4') > - 1 || hdomain.indexOf('sit1a') > - 1 || hdomain.indexOf('review') > - 1) && hdomain.indexOf('ecnp.bankofamerica') > -1){ atProperty = unauthBAC; } //olbAuth LLEs if((hdomain.indexOf('secure-dev4') > - 1 || hdomain.indexOf('secure-sit1a') > - 1 || hdomain.indexOf('secure-review') > - 1 || hdomain.indexOf('secure-preview') > - 1) && hdomain.indexOf('ecnp.bankofamerica') > -1){ atProperty = olbAuth; } //olbAuth secure.bankofameria.com if(hdomain.startsWith('secure.bankofamerica.com')){ atProperty = olbAuth; } //ML based on Tealium profile if(utag_data.tealium_profile == 'ml'){ atProperty = ml; } //ML based on domain if(hdomain.startsWith('business') || hdomain.startsWith('www.ml.com') || hdomain.startsWith('ml.com') || hdomain.indexOf('merrilledge.com') > -1 || hdomain.indexOf('merrill.com') > -1 || hdomain.indexOf('privatebank.bankofamerica.com') > -1 || hdomain.startsWith('institute') || hdomain.indexOf('pbig.ml.com') > -1){ atProperty = ml; } //ML Auth based on Tealium profile if(utag_data.tealium_profile == 'mlauth'){ atProperty = mlAuth; } //ML Auth if(hdomain.startsWith('auth.privatebank.bankofamerica.com') || hdomain.startsWith('olui.fs.ml.com') || hdomain.startsWith('ouai.fs.ml.com') || hdomain.startsWith('olui2.fs.ml.com')){ atProperty = mlAuth; } //ML Auth LLEs if(hdomain.startsWith('auth.privatebankfssit1.bankofamerica.com') || hdomain.startsWith('olui2.fssit1.ml.com') || hdomain.startsWith('oaui.fssit1.ml.com')){ atProperty = mlAuth; } //Landing Pages if(hdomain.startsWith('promotions') || hdomain.startsWith('info')){ atProperty = landingPages; } //About if(hdomain.startsWith('about')){ atProperty = about; } //BMH if(hdomain.startsWith('bettermoneyhabits')){ atProperty = bmh; } return atProperty; } } } }, "guid": { "defaultValue": "", "modulePath": "core/src/lib/dataElements/javascriptVariable.js", "settings": { "path": "digitalData.user.olb3rdpartyid" } }, "appName": { "defaultValue": "", "modulePath": "core/src/lib/dataElements/customCode.js", "settings": { "source": function(event) { var pageInfoKey = _satellite.getVar("pageInfoKey"); if(pageInfoKey != null || pageInfoKey != undefined){ if(digitalData.page.pageInfo[pageInfoKey].appName != null){ return digitalData.page.pageInfo[pageInfoKey].appName; } } else{ return ''; } } } }, "customEvent-code": { "modulePath": "gcoe-adobe-client-data-layer/src/lib/dataElements/datalayerComputedState.js", "settings": { "path": "options.code" } }, "previouspage": { "modulePath": "common-web-sdk-plugins/src/lib/dataElements/getpreviousvalue.js", "settings": { "cookieName": "", "variableToCheck": "%pageName%" } }, "appStepName_params": { "modulePath": "core/src/lib/dataElements/customCode.js", "settings": { "source": function(event) { const decisionParams = [ 'appStepName', 'EcloAppStepName' ]; for (let param of decisionParams) { const value = _satellite.getVar(param); if (value) { return value; } } } } }, "language": { "modulePath": "core/src/lib/dataElements/customCode.js", "settings": { "source": function(event) { var pageInfoKey = _satellite.getVar("pageInfoKey"); if(pageInfoKey != null || pageInfoKey != undefined){ return digitalData.page.pageInfo[pageInfoKey].language; } else{ return ''; } } } }, "oaosource": { "modulePath": "core/src/lib/dataElements/queryStringParameter.js", "settings": { "name": "oaosource", "caseInsensitive": true } }, "EcloAppStepNumber": { "modulePath": "core/src/lib/dataElements/javascriptVariable.js", "settings": { "path": "cm.appStepNumber" } }, "mboxDecision": { "defaultValue": "", "modulePath": "core/src/lib/dataElements/javascriptVariable.js", "settings": { "path": "digitalData.page.attributes.mbox.decision" } }, "XDM:Identity Map": { "modulePath": "adobe-alloy/dist/lib/dataElements/identityMap/index.js", "settings": { "BDF": [ { "id": "%guid%", "primary": false, "authenticatedState": "authenticated" } ], "RRY": [ { "id": "%MMID V2%", "primary": false, "authenticatedState": "authenticated" } ], "FPID": [ { "id": "%FPID_CLIENT%", "primary": false, "authenticatedState": "ambiguous" } ] } }, "alloy present": { "modulePath": "core/src/lib/dataElements/customCode.js", "settings": { "source": function(event) { if(typeof alloy != 'undefined'){ return "true"; } } } }, "errorPage": { "modulePath": "core/src/lib/dataElements/customCode.js", "settings": { "source": function(event) { //1. Implement Error page in Adobe Launch for 2 & 3 //2. If digitalData.page.attributes.pageType="errorPage" OR ""error-page-template" OR ""errorspage", then treat as error page and set errorCode (evar52) to 404 //3. If PageID contains"404" or "error" or "timeout" and page title does not have "job" , thent treat as error page. If Page ID like 404, set error code to 404. If page ID like "error" set error code to 800. if page ID like "timeout" set error code to 900. let ep = false; if(digitalData) if(digitalData.page) if(digitalData.page.attributes) if(digitalData.page.attributes.pageType != null) if(digitalData.page.attributes.pageType.indexOf('error') > -1){ //return "error page"; ep = true; } else { var pageInfoKey = _satellite.getVar("pageInfoKey"); if(pageInfoKey != null || pageInfoKey != undefined){ if((digitalData.page.pageInfo[pageInfoKey].pageID.indexOf('404') > -1) || (digitalData.page.pageInfo[pageInfoKey].pageID.indexOf('error') > -1) || (digitalData.page.pageInfo[pageInfoKey].pageID.indexOf('timeout') > -1)){ //return "error page"; ep = true; } } } return ep; } } }, "EcloOlbCust": { "modulePath": "core/src/lib/dataElements/javascriptVariable.js", "settings": { "path": "cm.olbCust" } }, "solutionFinder": { "modulePath": "core/src/lib/dataElements/customCode.js", "settings": { "source": function(event) { return ((_satellite.getVar('sfp') != '') ? _satellite.getVar('sfp')+"a" : '') + ((_satellite.getVar('sfb') != '') ? _satellite.getVar('sfb')+"a" : '') + ((_satellite.getVar('sfrr') != '') ? _satellite.getVar('sfrr')+"a" : '') +((_satellite.getVar('sfds') != '') ? _satellite.getVar('sfds')+"a" : ''); } } }, "errorCode": { "modulePath": "core/src/lib/dataElements/customCode.js", "settings": { "source": function(event) { var pageInfoKey = _satellite.getVar("pageInfoKey"); if(pageInfoKey != null || pageInfoKey != undefined){ if((digitalData.page.pageInfo[pageInfoKey].pageID.indexOf('404') > -1)){ return "404"; } if(digitalData.page.pageInfo[pageInfoKey].pageID.indexOf('error') > -1) { return "800"; } if(digitalData.page.pageInfo[pageInfoKey].pageID.indexOf('timeout') > -1){ return "900" } } if(digitalData.page.attributes.pageType != null){ if(digitalData.page.attributes.pageType.indexOf('error') > -1){ return "404"; } } } } }, "UserAuth_params": { "modulePath": "core/src/lib/dataElements/customCode.js", "settings": { "source": function(event) { const decisionParams = [ 'user.authenticated', 'EcloOlbCust' ]; for (let param of decisionParams) { const value = _satellite.getVar(param); if (value) { return value; } } } } }, "sourceid_query_param": { "modulePath": "core/src/lib/dataElements/queryStringParameter.js", "settings": { "name": "sourceid", "caseInsensitive": true } }, "customError-code": { "modulePath": "gcoe-adobe-client-data-layer/src/lib/dataElements/datalayerComputedState.js", "settings": { "path": "errorCode" } }, "MMID V2": { "modulePath": "core/src/lib/dataElements/cookie.js", "settings": { "name": "MMID" } }, "pageURL": { "modulePath": "core/src/lib/dataElements/customCode.js", "settings": { "source": function(event) { return document.location.href; } } }, "chatLoanType": { "defaultValue": "", "modulePath": "core/src/lib/dataElements/javascriptVariable.js", "settings": { "path": "digitalData.page.attributes.chat.LoanType" } }, "XDM:Site Promotions Impressions": { "modulePath": "adobe-alloy/dist/lib/dataElements/xdmObject/index.js", "settings": { "data": { "web": { "webInteraction": { "name": "Site Promotions Impressions", "type": "other", "linkClicks": { "value": 1 } }, "webPageDetails": { "name": "%pageName%", "server": "%pageDomain%" } }, "_experience": { "analytics": { "event1to100": { "event1": { "value": 1 } }, "customDimensions": { "eVars": { "eVar1": "%pageURL%", "eVar4": "%referrer%", "eVar78": "%coreURL%", "eVar81": "%pageName%", "eVar211": "%PageTitle%" }, "lists": { "list1": { "list": [ { "value": "%event.message.options.value%" } ] }, "list2": { "list": [ { "value": "%COIDS%" } ] } }, "props": { "prop51": "%pageID fallback%" } } } }, "identityMap": "%XDM:Identity Map%" }, "sandbox": { "name": "dev" } } }, "appStepNumber_params": { "modulePath": "core/src/lib/dataElements/customCode.js", "settings": { "source": function(event) { const decisionParams = [ 'appStepNumber', 'EcloAppStepNumber' ]; for (let param of decisionParams) { const value = _satellite.getVar(param); if (value) { return value; } } } } }, "celebrusSessionID": { "modulePath": "core/src/lib/dataElements/customCode.js", "settings": { "source": function(event) { var celebrussn = _satellite.cookie.get("celebrussession"); if(celebrussn != '' && typeof celebrussn != 'undefined'){ if(typeof celebrussn.split("_")[0] != 'undefined'){ return celebrussn.split('_')[0]; } } } } }, "chatMLD_OAO_CONFIRMATIONNUMBER": { "defaultValue": "", "modulePath": "core/src/lib/dataElements/javascriptVariable.js", "settings": { "path": "digitalData.page.attributes.chat.MLD_OAO_CONFIRMATIONNUMBER" } }, "celebruspersisted": { "modulePath": "core/src/lib/dataElements/customCode.js", "settings": { "source": function(event) { var celebruspersist = _satellite.cookie.get("celebruspersisted"); if(celebruspersist != '' && typeof celebruspersist != 'undefined'){ if(typeof celebruspersist.split("_")[2] != 'undefined'){ return celebruspersist.split('_')[2]; } } } } }, "dataCollector-clone": { "defaultValue": "0", "modulePath": "core/src/lib/dataElements/customCode.js", "settings": { "source": function(event) { //window.adobeDataLayer = []; return dataCollector.length /*if(dataCollector){ for(i=0;i -1 && url.indexOf('campaignId') > -1){ const hash = url.split('#')[1]; // getstarted?campaignId=test const queryString = hash.split('?')[1]; // campaignId=test // Parse query parameters const params = new URLSearchParams(queryString); const campaignId = params.get('campaignId'); return campaignId; } else if(url.indexOf('campaignId') > -1){ const params = new URL(url).searchParams; const campaignId = params.get('campaignId'); return campaignId; } } } }, "state": { "modulePath": "core/src/lib/dataElements/cookie.js", "settings": { "name": "state" } }, "internal_search_params": { "modulePath": "core/src/lib/dataElements/customCode.js", "settings": { "source": function(event) { const searchParams = [ 'q_internal_search_params', 'k_internal_search_params', 'keywords_internal_search_params', 'searchterm_internal_search_params' ]; for (let param of searchParams) { const value = _satellite.getVar(param); if (value) { return value; } } } } }, "cq_cmp_query_param": { "modulePath": "core/src/lib/dataElements/queryStringParameter.js", "settings": { "name": "cq_cmp", "caseInsensitive": true } }, "EcloCampaignId": { "modulePath": "core/src/lib/dataElements/javascriptVariable.js", "settings": { "path": "cm.campaignId" } }, "XDM:Video Play": { "modulePath": "adobe-alloy/dist/lib/dataElements/xdmObject/index.js", "settings": { "data": { "web": { "webInteraction": { "name": "Video Play", "type": "other", "linkClicks": { "value": 1 } }, "webPageDetails": { "name": "%pageName%", "server": "%pageDomain%" } }, "_experience": { "analytics": { "event1to100": { "event52": { "value": 1 } }, "customDimensions": { "eVars": { "eVar1": "%pageURL%", "eVar25": "%pageName%", "eVar68": "%videoID%", "eVar78": "%coreURL%", "eVar81": "%pageName%" }, "props": { "prop33": "%pageName%" } } } }, "identityMap": "%XDM:Identity Map%" }, "sandbox": { "name": "dev" } } }, "chatNumber_Of_Checking_Accounts": { "defaultValue": "", "modulePath": "core/src/lib/dataElements/javascriptVariable.js", "settings": { "path": "digitalData.page.attributes.chat.Number_Of_Checking_Accounts" } }, "sgm_query_param": { "modulePath": "core/src/lib/dataElements/queryStringParameter.js", "settings": { "name": "sgm", "caseInsensitive": true } }, "chatSubSection": { "defaultValue": "", "modulePath": "core/src/lib/dataElements/javascriptVariable.js", "settings": { "path": "digitalData.page.attributes.chat.sub_section" } }, "celebrusContentKey": { "modulePath": "core/src/lib/dataElements/customCode.js", "settings": { "source": function(event) { var celebruscontentkey = _satellite.cookie.get("celebrussession"); if(celebruscontentkey != '' && typeof celebruscontentkey != 'undefined'){ if(typeof celebruscontentkey.split("_")[4] != 'undefined'){ return celebruscontentkey.split('_')[4]; } } } } }, "chatMobileIndicator": { "defaultValue": "", "modulePath": "core/src/lib/dataElements/javascriptVariable.js", "settings": { "path": "digitalData.page.attributes.chat.mobileIndicator" } }, "chatInqClientOrderNum": { "defaultValue": "", "modulePath": "core/src/lib/dataElements/javascriptVariable.js", "settings": { "path": "digitalData.page.attributes.chat.inqClientOrderNum" } }, "prstat_query_param": { "modulePath": "core/src/lib/dataElements/queryStringParameter.js", "settings": { "name": "prstat", "caseInsensitive": true } }, "demandbase_stock_ticker": { "defaultValue": "", "modulePath": "core/src/lib/dataElements/javascriptVariable.js", "settings": { "path": "digitalData.user.company.stock_ticker" } }, "isSBCustomer": { "modulePath": "core/src/lib/dataElements/cookie.js", "settings": { "name": "isSBCustomer" } }, "chatInqOrderType": { "defaultValue": "", "modulePath": "core/src/lib/dataElements/javascriptVariable.js", "settings": { "path": "digitalData.page.attributes.chat.inqOrderType" } }, "marketingCode_query_param": { "modulePath": "core/src/lib/dataElements/queryStringParameter.js", "settings": { "name": "marketingCode", "caseInsensitive": true } }, "demandbase_employee_count": { "defaultValue": "", "modulePath": "core/src/lib/dataElements/javascriptVariable.js", "settings": { "path": "digitalData.user.company.employee_count" } }, "utm_campaign": { "modulePath": "core/src/lib/dataElements/queryStringParameter.js", "settings": { "name": "utm_campaign", "caseInsensitive": true } }, "chatNumber_Of_Other_Accounts": { "defaultValue": "", "modulePath": "core/src/lib/dataElements/javascriptVariable.js", "settings": { "path": "digitalData.page.attributes.chat.Number_Of_Other_Accounts" } }, "utm_source": { "modulePath": "core/src/lib/dataElements/queryStringParameter.js", "settings": { "name": "utm_source", "caseInsensitive": true } }, "wordCountEvent": { "modulePath": "core/src/lib/dataElements/customCode.js", "settings": { "source": function(event) { if(_satellite.getVar('wordCount') != ''){ return parseInt(_satellite.getVar('wordCount')) } else{ return 0; } } } }, "OptanonConsent": { "modulePath": "core/src/lib/dataElements/customCode.js", "settings": { "source": function(event) { var OptanonConsent = _satellite.cookie.get("OptanonConsent"); var groupValue=''; if(typeof OptanonConsent != 'undefined'){ var vars = OptanonConsent.split("&"); for (var i=0;i -1){ return _satellite.getVar('customEvent-eventKey')+"-_-"+_satellite.getVar('customEvent-code')+"-_-"+_satellite.getVar('customEvent-description'); } } } }, "EcloSourceCode": { "modulePath": "core/src/lib/dataElements/javascriptVariable.js", "settings": { "path": "cm.sc" } }, "DCLID": { "modulePath": "core/src/lib/dataElements/queryStringParameter.js", "settings": { "name": "DCLID", "caseInsensitive": true } }, "demandbase_city": { "defaultValue": "", "modulePath": "core/src/lib/dataElements/javascriptVariable.js", "settings": { "path": "digitalData.user.company.city" } }, "mboxProductPurchasedId": { "defaultValue": "", "modulePath": "core/src/lib/dataElements/javascriptVariable.js", "settings": { "path": "digitalData.page.attributes.mbox.productPurchasedId" } }, "manualLinkClick-name": { "modulePath": "gcoe-adobe-client-data-layer/src/lib/dataElements/datalayerComputedState.js", "settings": { "path": "linkname" } }, "PageTitle": { "modulePath": "core/src/lib/dataElements/customCode.js", "settings": { "source": function(event) { return document.title; } } }, "sfds": { "defaultValue": "", "modulePath": "core/src/lib/dataElements/queryStringParameter.js", "settings": { "name": "sfds", "caseInsensitive": true } }, "cartAttributesApplicationId": { "defaultValue": "", "modulePath": "core/src/lib/dataElements/javascriptVariable.js", "settings": { "path": "digitalData.cart.attributes.applicationId" } }, "cartFulfilmentID": { "defaultValue": "", "modulePath": "core/src/lib/dataElements/javascriptVariable.js", "settings": { "path": "digitalData.cart.fulfilmentID" } }, "EcloAppName": { "modulePath": "core/src/lib/dataElements/javascriptVariable.js", "settings": { "path": "cm.appName" } }, "appName_params": { "modulePath": "core/src/lib/dataElements/customCode.js", "settings": { "source": function(event) { const decisionParams = [ 'appName', 'EcloAppName' ]; for (let param of decisionParams) { const value = _satellite.getVar(param); if (value) { return value; } } } } }, "XDM:Video 75Per": { "modulePath": "adobe-alloy/dist/lib/dataElements/xdmObject/index.js", "settings": { "data": { "web": { "webInteraction": { "name": "Video 75 Per ", "type": "other", "linkClicks": { "value": 1 } }, "webPageDetails": { "name": "%pageName%", "server": "%pageDomain%" } }, "_experience": { "analytics": { "event1to100": { "event42": { "value": 1 } }, "customDimensions": { "eVars": { "eVar1": "%pageURL%", "eVar25": "%pageName%", "eVar68": "%videoID%", "eVar78": "%coreURL%", "eVar81": "%pageName%" }, "props": { "prop33": "%pageName%" } } } }, "identityMap": "%XDM:Identity Map%" }, "sandbox": { "name": "dev" } } }, "pageAddlCategory": { "defaultValue": "", "modulePath": "core/src/lib/dataElements/javascriptVariable.js", "settings": { "path": "digitalData.page.category.addlCategory" } }, "userType": { "defaultValue": "", "modulePath": "core/src/lib/dataElements/javascriptVariable.js", "settings": { "path": "digitalData.page.attributes.userType" } }, "XDM:FormInteractionOOTB": { "modulePath": "adobe-alloy/dist/lib/dataElements/xdmObject/index.js", "settings": { "data": { "web": { "webInteraction": { "name": "%formFieldValues%", "type": "other", "linkClicks": { "value": 1 } } }, "_experience": { "analytics": { "customDimensions": { "eVars": { "eVar1": "%pageURL%", "eVar25": "%pageName%", "eVar78": "%coreURL%", "eVar81": "%pageName%", "eVar213": "%formFieldValues%" }, "props": { "prop33": "%pageName%" } } } }, "identityMap": "%XDM:Identity Map%" }, "sandbox": { "name": "dev" } } }, "chatMLD_OAO_ACCOUNTNUMBER": { "defaultValue": "", "modulePath": "core/src/lib/dataElements/javascriptVariable.js", "settings": { "path": "digitalData.page.attributes.chat.MLD_OAO_ACCOUNTNUMBER" } }, "referrer": { "modulePath": "core/src/lib/dataElements/customCode.js", "settings": { "source": function(event) { return document.referrer; } } }, "chatAccountType": { "defaultValue": "", "modulePath": "core/src/lib/dataElements/javascriptVariable.js", "settings": { "path": "digitalData.page.attributes.chat.account_type" } }, "cartAttributesStatus": { "modulePath": "core/src/lib/dataElements/javascriptVariable.js", "settings": { "path": "digitalData.cart.attributes.status" } }, "INTL_LANG": { "modulePath": "core/src/lib/dataElements/cookie.js", "settings": { "name": "INTL_LANG" } }, "BOAGeographicData": { "modulePath": "core/src/lib/dataElements/cookie.js", "settings": { "name": "boa_geographic_data" } }, "searchterm_internal_search_params": { "modulePath": "core/src/lib/dataElements/queryStringParameter.js", "settings": { "name": "searchterm", "caseInsensitive": true } }, "trackingCode": { "modulePath": "core/src/lib/dataElements/queryStringParameter.js", "settings": { "name": "cm_mmc", "caseInsensitive": true } }, "chatInqSalesQuantities": { "defaultValue": "", "modulePath": "core/src/lib/dataElements/javascriptVariable.js", "settings": { "path": "digitalData.page.attributes.chat.inqSalesQuantities" } }, "FBCLID": { "modulePath": "core/src/lib/dataElements/queryStringParameter.js", "settings": { "name": "FBCLID", "caseInsensitive": true } }, "productID": { "defaultValue": "", "modulePath": "core/src/lib/dataElements/javascriptVariable.js", "settings": { "path": "digitalData.product.productInfo.productID" } }, "demandbase_watch_list_source_company": { "defaultValue": "", "modulePath": "core/src/lib/dataElements/javascriptVariable.js", "settings": { "path": "digitalData.user.company.watch_list_source_company" } }, "q_internal_search_params": { "modulePath": "core/src/lib/dataElements/queryStringParameter.js", "settings": { "name": "q", "caseInsensitive": true } }, "applicationDecision_params": { "modulePath": "core/src/lib/dataElements/customCode.js", "settings": { "source": function(event) { const decisionParams = [ 'cartApplicationDecision', 'cartAttributesStatus' ]; for (let param of decisionParams) { const value = _satellite.getVar(param); if (value) { return value; } } } } }, "XDM:Product Purchase": { "modulePath": "adobe-alloy/dist/lib/dataElements/xdmObject/index.js", "settings": { "data": { "web": { "webInteraction": { "name": "Product Purchase", "type": "other", "linkClicks": { "value": 1 } }, "webPageDetails": { "name": "%pageName%", "server": "%pageDomain%" } }, "_experience": { "analytics": { "event1to100": { "event11": { "value": 1 } }, "customDimensions": { "eVars": { "eVar1": "%pageURL%", "eVar8": "%applicationLOB%", "eVar25": "%pageName%", "eVar78": "%coreURL%", "eVar81": "%pageName%", "eVar123": "%sourceCode_params%", "eVar124": "%campaignId_params%", "eVar211": "%PageTitle%", "eVar227": "%USAApp%" }, "props": { "prop33": "%pageName%", "prop51": "%pageID fallback%" } } } }, "identityMap": "%XDM:Identity Map%", "productListItems": "%prodpurchasePLI%" }, "sandbox": { "name": "dev" } } }, "XDM:Video Pause": { "modulePath": "adobe-alloy/dist/lib/dataElements/xdmObject/index.js", "settings": { "data": { "web": { "webInteraction": { "name": "Video Pause", "type": "other", "linkClicks": { "value": 1 } }, "webPageDetails": { "name": "%pageName%", "server": "%pageDomain%" } }, "_experience": { "analytics": { "event1to100": { "event53": { "value": 1 } }, "customDimensions": { "eVars": { "eVar1": "%pageURL%", "eVar25": "%pageName%", "eVar68": "%videoID%", "eVar78": "%coreURL%", "eVar81": "%pageName%" }, "props": { "prop33": "%pageName%" } } } }, "identityMap": "%XDM:Identity Map%" }, "sandbox": { "name": "dev" } } }, "sitePromotionClickthrough": { "modulePath": "core/src/lib/dataElements/customCode.js", "settings": { "source": function(event) { if(_satellite.getVar('internalCampaign') != '' && _satellite.getVar('internalCampaign') != undefined){ return 1; } else{ return 0; } } } }, "GCLID": { "modulePath": "core/src/lib/dataElements/queryStringParameter.js", "settings": { "name": "GCLID", "caseInsensitive": true } }, "chatProductType": { "defaultValue": "", "modulePath": "core/src/lib/dataElements/javascriptVariable.js", "settings": { "path": "digitalData.page.attributes.chat.Product_type" } }, "user.authenticated": { "modulePath": "core/src/lib/dataElements/customCode.js", "settings": { "source": function(event) { if(typeof digitalData.user.authenticated == 'boolean'){ return digitalData.user.authenticated.toString(); } else{ return ''; } } } }, "lastPageNameFromHistory": { "modulePath": "core/src/lib/dataElements/customCode.js", "settings": { "source": function(event) { var lastPageName = ''; //console.log('lastPageName START') if(digitalData.page.attributes.pageIDHistory) { for(i=0;i-1){content.xdm.web.webInteraction.name = 'Scroll Depth 100%'} else if(content.xdm.eventType.indexOf('25PerScroll')>-1){content.xdm.web.webInteraction.name = 'Scroll Depth 25%'} else if(content.xdm.eventType.indexOf('1PerScroll')>-1){content.xdm.web.webInteraction.name = 'Scroll Depth 1%'} else if(content.xdm.eventType.indexOf('50PerScroll')>-1){content.xdm.web.webInteraction.name = 'Scroll Depth 50%'} else if(content.xdm.eventType.indexOf('75PerScroll')>-1){content.xdm.web.webInteraction.name = 'Scroll Depth 75%'} else if(content.xdm.eventType.indexOf('videoPaused')>-1){content.xdm.web.webInteraction.name = 'Video Pause'} else if(content.xdm.eventType.indexOf('videoPlayed')>-1){content.xdm.web.webInteraction.name = 'Video Start'} else if(content.xdm.eventType.indexOf('25Percent')>-1){content.xdm.web.webInteraction.name = 'Video 25% Milestone'} else if(content.xdm.eventType.indexOf('50Percent')>-1){content.xdm.web.webInteraction.name = 'Video 50% Milestone'} else if(content.xdm.eventType.indexOf('75Percent')>-1){content.xdm.web.webInteraction.name = 'Video 75% Milestone'} else if(content.xdm.eventType.indexOf('100Percent')>-1){content.xdm.web.webInteraction.name = 'Video Complete'} } }, "edgeConfigOverrides": { "staging": { "com_adobe_target": { "propertyToken": "%at_property%" } }, "production": { "com_adobe_target": { "propertyToken": "%at_property%" } }, "development": { "com_adobe_target": { "propertyToken": "%at_property%" } } }, "stagingEdgeConfigId": "%datastream%", "targetMigrationEnabled": true, "developmentEdgeConfigId": "%datastream%" } ] }, "modules": { "adobe-alloy/dist/lib/dataElements/xdmObject/index.js": { "name": "xdm-object", "displayName": "XDM object", "script": function(module, exports, require, turbine) { "use strict"; /* Copyright 2019 Adobe. All rights reserved. This file is licensed to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ module.exports = function (settings) { return settings.data; }; } }, "adobe-alloy/dist/lib/dataElements/identityMap/index.js": { "name": "identity-map", "displayName": "Identity map", "script": function(module, exports, require, turbine) { "use strict"; /* Copyright 2019 Adobe. All rights reserved. This file is licensed to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ var createIdentityMap = require("./createIdentityMap"); var identityMap = createIdentityMap({ logger: turbine.logger }); module.exports = function (settings) { return identityMap(settings); }; } }, "adobe-alloy/dist/lib/actions/sendEvent/index.js": { "name": "send-event", "displayName": "Send event", "script": function(module, exports, require, turbine) { "use strict"; var _turbine$environment; /* Copyright 2019 Adobe. All rights reserved. This file is licensed to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ var createSendEvent = require("./createSendEvent"); var instanceManager = require("../../instanceManager/index"); var _require = require("../../index"), sendEventCallbackStorage = _require.sendEventCallbackStorage; var createGetConfigOverrides = require("../../utils/createGetConfigOverrides"); module.exports = createSendEvent({ instanceManager: instanceManager, sendEventCallbackStorage: sendEventCallbackStorage, getConfigOverrides: createGetConfigOverrides((_turbine$environment = turbine.environment) === null || _turbine$environment === void 0 ? void 0 : _turbine$environment.stage) }); } }, "adobe-alloy/dist/lib/instanceManager/index.js": { "script": function(module, exports, require, turbine) { "use strict"; var _turbine$environment; /* Copyright 2019 Adobe. All rights reserved. This file is licensed to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ // The Adobe Launch bundler doesn't handle requiring npm packages, but this is // equivalent to require("@adobe/alloy"). We could run our own bundler to do this, // but this works. If Alloy changed the location of its cjs entry point we would // need to change the path here. var _require = require("../alloy"), createInstance = _require.createInstance, createEventMergeId = _require.createEventMergeId; var createInstanceManager = require("./createInstanceManager"); var injectWrapOnBeforeEventSend = require("./injectWrapOnBeforeEventSend"); var createGetConfigOverrides = require("../utils/createGetConfigOverrides"); var version = "2.25.0"; var wrapOnBeforeEventSend = injectWrapOnBeforeEventSend({ version: version }); module.exports = createInstanceManager({ turbine: turbine, window: window, createInstance: createInstance, createEventMergeId: createEventMergeId, orgId: _satellite.company.orgId, wrapOnBeforeEventSend: wrapOnBeforeEventSend, getConfigOverrides: createGetConfigOverrides((_turbine$environment = turbine.environment) === null || _turbine$environment === void 0 ? void 0 : _turbine$environment.stage) }); } }, "adobe-alloy/dist/lib/dataElements/identityMap/createIdentityMap.js": { "script": function(module, exports, require, turbine) { "use strict"; /* Copyright 2021 Adobe. All rights reserved. This file is licensed to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ /** * Provided an identity map, returns a new identity map that excludes any * identifiers whose ID values are not populated strings. Namespaces * without identifiers are also excluded. */ module.exports = function (_ref) { var logger = _ref.logger; return function (settings) { // settings _are_ the identity map return Object.keys(settings).reduce(function (newIdentityMap, namespace) { var filteredIdentifiers = settings[namespace].filter(function (_ref2, i) { var id = _ref2.id; var isValidId = typeof id === "string" && id.length; if (!isValidId) { logger.log("The identifier at ".concat(namespace, "[").concat(i, "] was removed from the identity map because its ID is not a populated string. Its ID value is:"), id); } return isValidId; }); if (filteredIdentifiers.length) { newIdentityMap[namespace] = filteredIdentifiers; } else { logger.log("The ".concat(namespace, " namespace was removed from the identity map because it contains no identifiers.")); } return newIdentityMap; }, {}); }; }; } }, "adobe-alloy/dist/lib/actions/sendEvent/createSendEvent.js": { "script": function(module, exports, require, turbine) { "use strict"; var _excluded = ["instanceName"]; function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], t.indexOf(o) >= 0 || {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; } function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (e.indexOf(n) >= 0) continue; t[n] = r[n]; } return t; } /* Copyright 2019 Adobe. All rights reserved. This file is licensed to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ var clone = require("../../utils/clone"); module.exports = function (_ref) { var instanceManager = _ref.instanceManager, sendEventCallbackStorage = _ref.sendEventCallbackStorage, getConfigOverrides = _ref.getConfigOverrides; return function (settings) { var instanceName = settings.instanceName, sendEventSettings = _objectWithoutProperties(settings, _excluded); sendEventSettings.edgeConfigOverrides = getConfigOverrides(sendEventSettings); var instance = instanceManager.getInstance(instanceName); if (!instance) { throw new Error("Failed to send event for instance \"".concat(instanceName, "\". No matching instance was configured with this name.")); } // If the customer modifies the xdm or data object (or anything nested in the object) after this action runs, // we want to make sure those modifications are not reflected in the data sent to the server. By cloning the // objects here, we ensure we use a snapshot that will remain unchanged during the time period between when // sendEvent is called and the network request is made. if (sendEventSettings.xdm) { sendEventSettings.xdm = clone(sendEventSettings.xdm); } if (sendEventSettings.data) { sendEventSettings.data = clone(sendEventSettings.data); } return instance("sendEvent", sendEventSettings).then(function (result) { sendEventCallbackStorage.triggerEvent(result); }); }; }; } }, "adobe-alloy/dist/lib/index.js": { "script": function(module, exports, require, turbine) { "use strict"; /* Copyright 2023 Adobe. All rights reserved. This file is licensed to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ var createEventMergeIdCache = require("./createEventMergeIdCache"); var createSendEventCallbackStorage = require("./createSendEventCallbackStorage"); var createMediaCollectionSessionStorage = require("./createMediaCollectionSessionStorage"); var createVariableStore = require("./createVariableStore"); exports.eventMergeIdCache = createEventMergeIdCache(); exports.sendEventCallbackStorage = createSendEventCallbackStorage(); exports.mediaCollectionSessionStorage = createMediaCollectionSessionStorage(); exports.variableStore = createVariableStore(); } }, "adobe-alloy/dist/lib/utils/createGetConfigOverrides.js": { "script": function(module, exports, require, turbine) { "use strict"; function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); } function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; } function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; } function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; } function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; } function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); } /* Copyright 2023 Adobe. All rights reserved. This file is licensed to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ /** * Create the config overrides for the given environment. * * @typedef {Object} EdgeConfigOverrides * * @param {Object} settings * @param { { development: EdgeConfigOverrides, staging: EdgeConfigOverrides, production: EdgeConfigOverrides }= } settings.edgeConfigOverrides * @param {"development" | "staging" | "production"} environmentName * @returns {EdgeConfigOverrides?} */ var createGetConfigOverrides = function createGetConfigOverrides(environmentName) { return function (settings) { var _computedConfigOverri, _computedConfigOverri2, _computedConfigOverri3, _computedConfigOverri4; var edgeConfigOverrides = settings.edgeConfigOverrides; var computedConfigOverrides; if (!edgeConfigOverrides) { return undefined; } if (!edgeConfigOverrides[environmentName]) { // there are no settings for this current env, but there are settings for others if (edgeConfigOverrides.development || edgeConfigOverrides.staging || edgeConfigOverrides.production) { return undefined; } // there are old settings computedConfigOverrides = edgeConfigOverrides; } else { computedConfigOverrides = _objectSpread({}, edgeConfigOverrides[environmentName]); } if (Object.keys(computedConfigOverrides).length === 0) { return undefined; } if (((_computedConfigOverri = computedConfigOverrides.com_adobe_analytics) === null || _computedConfigOverri === void 0 || (_computedConfigOverri = _computedConfigOverri.reportSuites) === null || _computedConfigOverri === void 0 ? void 0 : _computedConfigOverri.length) > 0) { computedConfigOverrides.com_adobe_analytics.reportSuites = computedConfigOverrides.com_adobe_analytics.reportSuites.flatMap(function (val) { return val.includes(",") ? val.split(/,\s*/gi) : val; }).map(function (rsid) { return rsid.trim(); }).filter(Boolean); } if (((_computedConfigOverri2 = computedConfigOverrides.com_adobe_identity) === null || _computedConfigOverri2 === void 0 ? void 0 : _computedConfigOverri2.idSyncContainerId) !== undefined && ((_computedConfigOverri3 = computedConfigOverrides.com_adobe_identity) === null || _computedConfigOverri3 === void 0 ? void 0 : _computedConfigOverri3.idSyncContainerId) !== null && typeof ((_computedConfigOverri4 = computedConfigOverrides.com_adobe_identity) === null || _computedConfigOverri4 === void 0 ? void 0 : _computedConfigOverri4.idSyncContainerId) === "string") { var parsedValue = parseInt(computedConfigOverrides.com_adobe_identity.idSyncContainerId.trim(), 10); if (Number.isNaN(parsedValue)) { throw new Error("The ID sync container ID \"".concat(computedConfigOverrides.com_adobe_identity.idSyncContainerId, "\" is not a valid integer.")); } computedConfigOverrides.com_adobe_identity.idSyncContainerId = parsedValue; } return computedConfigOverrides; }; }; module.exports = createGetConfigOverrides; } }, "adobe-alloy/dist/lib/utils/clone.js": { "script": function(module, exports, require, turbine) { "use strict"; /* Copyright 2020 Adobe. All rights reserved. This file is licensed to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ /** * Clones a value by serializing then deserializing the value. * @param {*} value * @returns {any} */ module.exports = function (value) { return JSON.parse(JSON.stringify(value)); }; } }, "adobe-alloy/dist/lib/alloy.js": { "script": function(module, exports, require, turbine) { "use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.deepAssign=exports.createInstance=exports.createEventMergeId=void 0;var _reactorObjectAssign=_interopRequireDefault(require("@adobe/reactor-object-assign"));var _reactorQueryString=_interopRequireDefault(require("@adobe/reactor-query-string"));var _reactorLoadScript=_interopRequireDefault(require("@adobe/reactor-load-script"));var _MATCHERS;var _excluded=["xdm","data","documentUnloading","type","mergeId","datasetId","edgeConfigOverrides"],_excluded2=["datastreamId"],_excluded3=["priority"],_excluded4=["trackingLabel","scopeType"],_excluded5=["standard","version"],_excluded6=["edgeConfigOverrides"];function _interopRequireDefault(e){return e&&e.__esModule?e:{"default":e};}function _objectWithoutProperties(e,t){if(null==e)return{};var o,r,i=_objectWithoutPropertiesLoose(e,t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);for(r=0;r=0||{}.propertyIsEnumerable.call(e,o)&&(i[o]=e[o]);}return i;}function _objectWithoutPropertiesLoose(r,e){if(null==r)return{};var t={};for(var n in r)if({}.hasOwnProperty.call(r,n)){if(e.indexOf(n)>=0)continue;t[n]=r[n];}return t;}function _slicedToArray(r,e){return _arrayWithHoles(r)||_iterableToArrayLimit(r,e)||_unsupportedIterableToArray(r,e)||_nonIterableRest();}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");}function _iterableToArrayLimit(r,l){var t=null==r?null:"undefined"!=typeof Symbol&&r[Symbol.iterator]||r["@@iterator"];if(null!=t){var e,n,i,u,a=[],f=!0,o=!1;try{if(i=(t=t.call(r)).next,0===l){if(Object(t)!==t)return;f=!1;}else for(;!(f=(e=i.call(t)).done)&&(a.push(e.value),a.length!==l);f=!0);}catch(r){o=!0,n=r;}finally{try{if(!f&&null!=t["return"]&&(u=t["return"](),Object(u)!==u))return;}finally{if(o)throw n;}}return a;}}function _arrayWithHoles(r){if(Array.isArray(r))return r;}function ownKeys(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);r&&(o=o.filter(function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable;})),t.push.apply(t,o);}return t;}function _objectSpread(e){for(var r=1;rr.length)&&(a=r.length);for(var e=0,n=Array(a);e1?_len2-1:0),_key2=1;_key2<_len2;_key2++){sources[_key2-1]=arguments[_key2];}sources.forEach(function(source){return deepAssignObject(result,Object(source));});return result;};/* Copyright 2019 Adobe. All rights reserved. This file is licensed to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ /** * Creates a function that, when passed an object of updates, will merge * the updates onto the current value of a payload property. * @param {Object} content The base object to modify * @param {String } key The property to merge updates into. This * can be a dot-notation property path. * @returns {Function} */var createMerger=function createMerger(content,key){return function(updates){var propertyPath=key.split(".");var hostObjectForUpdates=propertyPath.reduce(function(obj,propertyName){obj[propertyName]=obj[propertyName]||{};return obj[propertyName];},content);deepAssign(hostObjectForUpdates,updates);};};/* Copyright 2020 Adobe. All rights reserved. This file is licensed to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ /** * Allows callbacks to be registered and then later called. When the * callbacks are called, their responses are combined into a single promise. */var createCallbackAggregator=function createCallbackAggregator(){var callbacks=[];return{add:function add(callback){callbacks.push(callback);},call:function call(){for(var _len3=arguments.length,args=new Array(_len3),_key3=0;_key3<_len3;_key3++){args[_key3]=arguments[_key3];}// While this utility doesn't necessarily need to be doing the // Promise.all, it's currently useful everywhere this is used and // reduces repetitive code. We can factor it out later if we want // to make this utility more "pure". return Promise.all(callbacks.map(function(callback){return callback.apply(void 0,args);}));}};};/* Copyright 2022 Adobe. All rights reserved. This file is licensed to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */var createLoggingCookieJar=function createLoggingCookieJar(_ref){var logger=_ref.logger,cookieJar=_ref.cookieJar;return _objectSpread(_objectSpread({},cookieJar),{},{set:function set(key,value,options){logger.info("Setting cookie",_objectSpread({name:key,value:value},options));cookieJar.set(key,value,options);}});};/* Copyright 2020 Adobe. All rights reserved. This file is licensed to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ /** * Sequences tasks. */var createTaskQueue=function createTaskQueue(){var queueLength=0;var lastPromiseInQueue=Promise.resolve();return{/** * Add a task to the queue. If no task is currenty running, * the task will begin immediately. * @param {Function} task A function that will be called when * the task should be run. If the task it asynchronous, it should * return a promise. * @returns {Promise} A promise that will be resolved or rejected * with whatever value the task resolved or rejects its promise. */addTask:function addTask(task){queueLength+=1;var lastPromiseFulfilledHandler=function lastPromiseFulfilledHandler(){return task()["finally"](function(){queueLength-=1;});};lastPromiseInQueue=lastPromiseInQueue.then(lastPromiseFulfilledHandler,lastPromiseFulfilledHandler);return lastPromiseInQueue;},/** * How many tasks are in the queue. This includes the task * that's currently running. * @returns {number} */get length(){return queueLength;}};};/* eslint-disable */ /* crc32 · JavaScript Function to Calculate CRC32 of a String Description Below is a JavaScript function to calculate CRC32 of a string. The string can be either ASCII or Unicode. Unicode strings will be encoded in UTF-8. The polynomial used in calculation is 0xedb88320. This polynomial is used in Ethernet, Gzip, PNG, SATA and many other technologies. */var crc32=function(){var table=[];for(var _i=0;_i<256;_i++){var c=_i;for(var j=0;j<8;j++){c=c&1?0xedb88320^c>>>1:c>>>1;}table.push(c);}return function(str,crc){str=unescape(encodeURIComponent(str));if(!crc)crc=0;crc=crc^-1;for(var _i2=0;_i2>>8^table[y];}crc=crc^-1;return crc>>>0;};}();/* Copyright 2019 Adobe. All rights reserved. This file is licensed to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ /** * A simple utility for managing a promise's state outside of * the promise's "executor" (the function passed into the constructor). */var defer=function defer(){var deferred={};deferred.promise=new Promise(function(resolve,reject){deferred.resolve=resolve;deferred.reject=reject;});return deferred;};/* Copyright 2023 Adobe. All rights reserved. This file is licensed to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */var REFERENCE_EQUALITY=function REFERENCE_EQUALITY(a,b){return a===b;};var findIndex=function findIndex(array,item,isEqual){for(var _i3=0;_i31&&arguments[1]!==undefined?arguments[1]:REFERENCE_EQUALITY;return array.filter(function(item,index){return findIndex(array,item,isEqual)===index;});};/* Copyright 2019 Adobe. All rights reserved. This file is licensed to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ /** * Whether a string ends with the characters of a specified string * @param {String} str The string to search within. * @param {String} suffix The string to search for. * @returns {boolean} */var endsWith=function endsWith(str,suffix){return str.substr(-suffix.length)===suffix;};/* Copyright 2019 Adobe. All rights reserved. This file is licensed to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ /** * Returns the first item in the array that satisfies the provided testing function. * @param {Array} arr The array to search. * @param {Function} predicate Function that will be called for each item. Arguments * will be the item, the item index, then the array itself. * @returns {*} */var find=function find(arr,predicate){for(var _i4=0;_i41&&arguments[1]!==undefined?arguments[1]:{};var props=arguments.length>2&&arguments[2]!==undefined?arguments[2]:{};var children=arguments.length>3&&arguments[3]!==undefined?arguments[3]:[];var doc=arguments.length>4&&arguments[4]!==undefined?arguments[4]:document;var result=doc.createElement(tag);Object.keys(attrs).forEach(function(key){// TODO: To highlight CSP problems consider throwing a descriptive error // if nonce is available and key is style. result.setAttribute(key,attrs[key]);});populateElementProperties(result,props);children.forEach(function(child){return appendNode(result,child);});return result;};/* Copyright 2019 Adobe. All rights reserved. This file is licensed to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */var BODY="BODY";var IFRAME="IFRAME";var IMG="IMG";var DIV="DIV";var STYLE="STYLE";var SCRIPT="SCRIPT";var HEAD="HEAD";/* Copyright 2019 Adobe. All rights reserved. This file is licensed to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ /** * Fires an image pixel from the current document's window. * @param {object} currentDocument * @param {string} src * @returns {Promise} */var fireImageInDocument=function fireImageInDocument(_ref2){var src=_ref2.src,_ref2$currentDocument=_ref2.currentDocument,currentDocument=_ref2$currentDocument===void 0?document:_ref2$currentDocument;return new Promise(function(resolve,reject){var attrs={src:src};var props={onload:resolve,onerror:reject,onabort:reject};createNode(IMG,attrs,props,[],currentDocument);});};/* Copyright 2019 Adobe. All rights reserved. This file is licensed to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ /** * Returns whether the value is a function. * @param {*} value * @returns {boolean} */var isFunction=function isFunction(value){return typeof value==="function";};/* Copyright 2019 Adobe. All rights reserved. This file is licensed to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ /** * Returns whether the value is a non-empty array. * @param {*} value * @returns {boolean} */var isNonEmptyArray=function isNonEmptyArray(value){return Array.isArray(value)&&value.length>0;};/* Copyright 2019 Adobe. All rights reserved. This file is licensed to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */var toArray=function toArray(value){if(Array.isArray(value)){return value;}if(value==null){return[];}return[].slice.call(value);};/* Copyright 2021 Adobe. All rights reserved. This file is licensed to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */var SIBLING_PATTERN=/^\s*>/;var querySelectorAll=function querySelectorAll(context,selector){if(!SIBLING_PATTERN.test(selector)){return toArray(context.querySelectorAll(selector));}var tag="alloy-".concat(Date.now());// We could use a :scope selector here, but we want to be IE compliant // so we add a dummy css class to be able to select the children try{context.classList.add(tag);return toArray(context.querySelectorAll(".".concat(tag," ").concat(selector)));}finally{context.classList.remove(tag);}};/* Copyright 2021 Adobe. All rights reserved. This file is licensed to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ /** * Whether a string starts with the characters of a specified string * @param {String} str The string to search within. * @param {String} prefix The string to search for. * @returns {boolean} */var startsWith=function startsWith(str,prefix){return str.substr(0,prefix.length)===prefix;};/* Copyright 2022 Adobe. All rights reserved. This file is licensed to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */var SHADOW_SEPARATOR=":shadow";/* Copyright 2021 Adobe. All rights reserved. This file is licensed to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */var splitWithShadow=function splitWithShadow(selector){return selector.split(SHADOW_SEPARATOR);};var transformPrefix=function transformPrefix(parent,selector){var result=selector;var hasChildCombinatorPrefix=startsWith(result,">");if(!hasChildCombinatorPrefix){return result;}// IE doesn't support :scope if(window.document.documentMode){return result.substring(1).trim();}var prefix=parent instanceof Element||parent instanceof HTMLDocument?":scope":":host";// see https://bugs.webkit.org/show_bug.cgi?id=233380 return"".concat(prefix," ").concat(result);};var selectNodesWithShadow=function selectNodesWithShadow(context,selector){// Shadow DOM should be supported if(!window.document.documentElement.attachShadow){return querySelectorAll(context,selector.replace(SHADOW_SEPARATOR,""));}var parts=splitWithShadow(selector);if(parts.length<2){return querySelectorAll(context,selector);}// split the selector into parts separated by :shadow pseudo-selectors // find each subselector element based on the previously selected node's shadowRoot var parent=context;for(var _i5=0;_i51&&arguments[1]!==undefined?arguments[1]:document;if(!isShadowSelector(selector)){return querySelectorAll(context,selector);}return selectNodesWithShadow(context,selector);};/* Copyright 2019 Adobe. All rights reserved. This file is licensed to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */var MUTATION_OBSERVER="MutationObserver";var RAF="requestAnimationFrame";var MUTATION_OBSERVER_CONFIG={childList:true,subtree:true};var VISIBILITY_STATE="visibilityState";var VISIBLE="visible";var DELAY=100;var MAX_POLLING_TIMEOUT=5000;var createError=function createError(selector){return new Error("Could not find: ".concat(selector));};var createPromise=function createPromise(executor){return new Promise(executor);};var canUseMutationObserver=function canUseMutationObserver(win){return isFunction(win[MUTATION_OBSERVER]);};var awaitUsingMutationObserver=function awaitUsingMutationObserver(win,doc,selector,timeout,selectFunc){return createPromise(function(resolve,reject){var timer;var mutationObserver=new win[MUTATION_OBSERVER](function(){var nodes=selectFunc(selector);if(isNonEmptyArray(nodes)){mutationObserver.disconnect();if(timer){clearTimeout(timer);}resolve(nodes);}});timer=setTimeout(function(){mutationObserver.disconnect();reject(createError(selector));},timeout);mutationObserver.observe(doc,MUTATION_OBSERVER_CONFIG);});};var canUseRequestAnimationFrame=function canUseRequestAnimationFrame(doc){return doc[VISIBILITY_STATE]===VISIBLE;};var awaitUsingRequestAnimation=function awaitUsingRequestAnimation(win,selector,timeout,selectFunc){return createPromise(function(resolve,reject){var execute=function execute(){var nodes=selectFunc(selector);if(isNonEmptyArray(nodes)){resolve(nodes);return;}win[RAF](execute);};execute();setTimeout(function(){reject(createError(selector));},timeout);});};var awaitUsingTimer=function awaitUsingTimer(selector,timeout,selectFunc){return createPromise(function(resolve,reject){var execute=function execute(){var nodes=selectFunc(selector);if(isNonEmptyArray(nodes)){resolve(nodes);return;}setTimeout(execute,DELAY);};execute();setTimeout(function(){reject(createError(selector));},timeout);});};var awaitSelector=function awaitSelector(selector){var selectFunc=arguments.length>1&&arguments[1]!==undefined?arguments[1]:selectNodes;var timeout=arguments.length>2&&arguments[2]!==undefined?arguments[2]:MAX_POLLING_TIMEOUT;var win=arguments.length>3&&arguments[3]!==undefined?arguments[3]:window;var doc=arguments.length>4&&arguments[4]!==undefined?arguments[4]:document;var nodes=selectFunc(selector);if(isNonEmptyArray(nodes)){return Promise.resolve(nodes);}if(canUseMutationObserver(win)){return awaitUsingMutationObserver(win,doc,selector,timeout,selectFunc);}if(canUseRequestAnimationFrame(doc)){return awaitUsingRequestAnimation(win,selector,timeout,selectFunc);}return awaitUsingTimer(selector,timeout,selectFunc);};/* Copyright 2019 Adobe. All rights reserved. This file is licensed to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ /** * Returns true if element matches the selector. * @param {String} selector * @param {Node} [element] * @returns {Boolean} */var matchesSelector=function matchesSelector(selector,element){if(element.matches){return element.matches(selector);}// Making IE 11 happy return element.msMatchesSelector(selector);};/* Copyright 2019 Adobe. All rights reserved. This file is licensed to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */var removeNode=function removeNode(node){var parent=node.parentNode;if(parent){return parent.removeChild(node);}return null;};/* Copyright 2019 Adobe. All rights reserved. This file is licensed to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */var IFRAME_ATTRS={name:"Adobe Alloy"};var IFRAME_PROPS={style:{display:"none",width:0,height:0}};var injectFireReferrerHideableImage=function injectFireReferrerHideableImage(){var _ref3=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{},_ref3$appendNode=_ref3.appendNode,appendNode$1=_ref3$appendNode===void 0?appendNode:_ref3$appendNode,_ref3$awaitSelector=_ref3.awaitSelector,awaitSelector$1=_ref3$awaitSelector===void 0?awaitSelector:_ref3$awaitSelector,_ref3$createNode=_ref3.createNode,createNode$1=_ref3$createNode===void 0?createNode:_ref3$createNode,_ref3$fireImage=_ref3.fireImage,fireImage=_ref3$fireImage===void 0?fireImageInDocument:_ref3$fireImage;var fireOnPage=fireImage;var hiddenIframe;var createIframe=function createIframe(){return awaitSelector$1(BODY).then(function(_ref4){var _ref5=_slicedToArray(_ref4,1),body=_ref5[0];if(hiddenIframe){return hiddenIframe;}hiddenIframe=createNode$1(IFRAME,IFRAME_ATTRS,IFRAME_PROPS);return appendNode$1(body,hiddenIframe);});};var fireInIframe=function fireInIframe(_ref6){var src=_ref6.src;return createIframe().then(function(iframe){var currentDocument=iframe.contentWindow.document;return fireImage({src:src,currentDocument:currentDocument});});};return function(request){var hideReferrer=request.hideReferrer,url=request.url;return hideReferrer?fireInIframe({src:url}):fireOnPage({src:url});};};/* Copyright 2019 Adobe. All rights reserved. This file is licensed to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ /** * Returns whether the value is an empty object. * @param {*} value * @returns {boolean} */var isEmptyObject=function isEmptyObject(value){return isObject(value)&&Object.keys(value).length===0;};/* Copyright 2022 Adobe. All rights reserved. This file is licensed to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ /** * Given an object and a function that takes a value and returns a predicate, filter out * all non-object deeply nested values that do not pass the predicate. * * Example: filterObject({ a: 2, b: { c: 6 } }, (val) => val > 5) returns { b { c: 6 } } * * @param {*} obj * @param {* => boolean} predicate a function that takes a value and return a boolean, * representing if it should be included in the result object or not. * @returns A copy of the original object with the values that fail the predicate, filtered out. */var filterObject=function filterObject(obj,predicate){if(isNil(obj)||!isObject(obj)){return obj;}return Object.keys(obj).reduce(function(result,key){var value=obj[key];if(isObject(value)){// value is object, go deeper var filteredValue=filterObject(value,predicate);if(isEmptyObject(filteredValue)){return result;}return _objectSpread(_objectSpread({},result),{},_defineProperty({},key,filteredValue));}// value is not an object, test predicate if(predicate(value)){return _objectSpread(_objectSpread({},result),{},_defineProperty({},key,value));}return result;},{});};/* Copyright 2019 Adobe. All rights reserved. This file is licensed to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */var flatMap=function flatMap(array,mapFunction){return Array.prototype.concat.apply([],array.map(mapFunction));};/* Copyright 2019 Adobe. All rights reserved. This file is licensed to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */var baseNamespace="com.adobe.alloy.";/* Copyright 2019 Adobe. All rights reserved. This file is licensed to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ /** * Returns the last N number of items from an array. * @param {Array} arr * @param {number} itemCount * @returns {Array} */var getLastArrayItems=function getLastArrayItems(arr,itemCount){return arr.slice(-itemCount);};/* Copyright 2019 Adobe. All rights reserved. This file is licensed to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */var cookieName="".concat(baseNamespace,"getTld");/** * Of the current web page's hostname, this is the top-most domain that is * not a "public suffix" as outlined in https://publicsuffix.org/. In other * words, this is top-most domain that is able to accept cookies. * @param {Object} window * @param {Object} cookieJar * @returns {string} */var getApexDomain=function getApexDomain(window,cookieJar){var topLevelCookieDomain="";// If hostParts.length === 1, we may be on localhost. var hostParts=window.location.hostname.toLowerCase().split(".");var i=1;while(i0;};/* Copyright 2019 Adobe. All rights reserved. This file is licensed to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ /** * Creates a function that memoizes the result of `fn`. If `keyResolver` is * provided, it determines the cache key for storing the result based on the * arguments provided to the memoized function. By default, the first argument * provided to the memoized function is used as the map cache key. * * @param {Function} fn The function to have its output memoized. * @param {Function} [keyResolver] The function to resolve the cache key. * @returns {Function} The new memoized function. */var memoize=function memoize(fn,keyResolver){var map=new Map();return function(){var key=arguments.length<=0?undefined:arguments[0];if(map.has(key)){return map.get(key);}var result=fn.apply(void 0,arguments);map.set(key,result);return result;};};/* Copyright 2019 Adobe. All rights reserved. This file is licensed to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ /** * A function that performs no operations. */var noop=function noop(){};/* Copyright 2019 Adobe. All rights reserved. This file is licensed to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ // adapted from https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/padStart var padStart=function padStart(string,targetLength,padString){var originalString=String(string);var repeatedPadString=String(padString);if(originalString.length>=targetLength||repeatedPadString.length===0){return originalString;}var lengthToAdd=targetLength-originalString.length;while(lengthToAdd>repeatedPadString.length){repeatedPadString+=repeatedPadString;}return repeatedPadString.slice(0,lengthToAdd)+originalString;};var commonjsGlobal=typeof globalThis!=='undefined'?globalThis:typeof window!=='undefined'?window:typeof global!=='undefined'?global:typeof self!=='undefined'?self:{};function getDefaultExportFromCjs(x){return x&&x.__esModule&&Object.prototype.hasOwnProperty.call(x,'default')?x['default']:x;}var src=function src(str){var opts=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};if(!str)return undefined;var o={key:['source','protocol','authority','userInfo','user','password','host','port','relative','path','directory','file','query','anchor'],q:{name:'queryKey',parser:/(?:^|&)([^&=]*)=?([^&]*)/g},parser:{strict:/^(?:([^:/?#]+):)?(?:\/\/((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(\d*))?))?((((?:[^?#/]*\/)*)([^?#]*))(?:\?([^#]*))?(?:#(.*))?)/,loose:/^(?:(?![^:@]+:[^:@/]*@)([^:/?#.]+):)?(?:\/\/)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#/]*\.[^?#/.]+(?:[?#]|$)))*\/?)?([^?#/]*))(?:\?([^#]*))?(?:#(.*))?)/}};var m=o.parser[opts.strictMode?'strict':'loose'].exec(str);var uri={};var i=14;while(i--)uri[o.key[i]]=m[i]||'';uri[o.q.name]={};uri[o.key[12]].replace(o.q.parser,function($0,$1,$2){if($1)uri[o.q.name][$1]=$2;});return uri;};var parseUri=/*@__PURE__*/getDefaultExportFromCjs(src);/* Copyright 2023 Adobe. All rights reserved. This file is licensed to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */var parseDomainBasic=function parseDomainBasic(host){var result={};var domainParts=host.split(".");switch(domainParts.length){case 1:result.subdomain="";result.domain=host;result.topLevelDomain="";break;case 2:result.subdomain="";result.domain=host;result.topLevelDomain=domainParts[1];break;case 3:result.subdomain=domainParts[0]==="www"?"":domainParts[0];result.domain=host;result.topLevelDomain=domainParts[2];break;case 4:result.subdomain=domainParts[0]==="www"?"":domainParts[0];result.domain=host;result.topLevelDomain="".concat(domainParts[2],".").concat(domainParts[3]);break;}return result;};var parseUrl=function parseUrl(url){var parseDomain=arguments.length>1&&arguments[1]!==undefined?arguments[1]:parseDomainBasic;if(!isString(url)){// eslint-disable-next-line no-param-reassign url="";}var parsed=parseUri(url)||{};var _parsed$host=parsed.host,host=_parsed$host===void 0?"":_parsed$host,_parsed$path=parsed.path,path=_parsed$path===void 0?"":_parsed$path,_parsed$query=parsed.query,query=_parsed$query===void 0?"":_parsed$query,_parsed$anchor=parsed.anchor,anchor=_parsed$anchor===void 0?"":_parsed$anchor;return _objectSpread({path:path,query:query,fragment:anchor},parseDomain(host));};/* Copyright 2022 Adobe. All rights reserved. This file is licensed to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ // We want to avoid mapping between specific keys because we want Konductor // to be able to add overrides in the future without us needing to make // any changes to the Web SDK var prepareConfigOverridesForEdge=function prepareConfigOverridesForEdge(configuration){if(isNil(configuration)||_typeof(configuration)!=="object"){return null;}// remove entries that are empty strings or arrays var configOverrides=filterObject(configuration,function(value){if(isNil(value)){return false;}if(isBoolean(value)){return true;}if(isNumber$1(value)){return true;}if(isNonEmptyString(value)){return true;}if(isNonEmptyArray(value)){return true;}return false;});if(isEmptyObject(configOverrides)){return null;}return configOverrides;};/* Copyright 2019 Adobe. All rights reserved. This file is licensed to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ /** * Creates and returns a new error using the provided value as a message. * If the provided value is already an Error, it will be returned unmodified. * @param {*} value * @returns {Error} */var toError=function toError(value){return value instanceof Error?value:new Error(value);};/* Copyright 2020 Adobe. All rights reserved. This file is licensed to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */var updateErrorMessage=function updateErrorMessage(_ref8){var error=_ref8.error,message=_ref8.message;try{error.message=message;}catch(e){// We'll set a new message when we can, but some errors, like DOMException, // have a read-only message property, which limits our options. }};/* Copyright 2019 Adobe. All rights reserved. This file is licensed to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ /** * Augments an error's message with additional context as it bubbles up the call stack. * @param {String} message The message to be added to the error. * @param {*} error Optimally, this is an instance of Error. If it is not, * this is used as the basis for the message of a newly created Error instance. * @returns {*} */var stackError=function stackError(_ref9){var error=_ref9.error,message=_ref9.message;var errorToStack=toError(error);var newMessage="".concat(message,"\nCaused by: ").concat(errorToStack.message);updateErrorMessage({error:errorToStack,message:newMessage});return errorToStack;};/* Copyright 2023 Adobe. All rights reserved. This file is licensed to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */var stringToBoolean=function stringToBoolean(str){return isString(str)&&str.toLowerCase()==="true";};/* Copyright 2022 Adobe. All rights reserved. This file is licensed to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ /* * coerce `value` to a number or return `defaultValue` if it cannot be. * * The coersion is attempted if value is a number or string. */var toInteger=function toInteger(value,defaultValue){if(isNumber$1(value)||isString(value)){var n=Math.round(Number(value));// eslint-disable-next-line no-restricted-globals if(!isNaN(n)){return n;}}return defaultValue;};/* Copyright 2019 Adobe. All rights reserved. This file is licensed to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ /** * Formats the date into an ISO date-time string in the local timezone * @param {Date} date * @returns {string} */var toISOStringLocal=function toISOStringLocal(date){var YYYY=date.getFullYear();var MM=padStart(date.getMonth()+1,2,"0");var DD=padStart(date.getDate(),2,"0");var hh=padStart(date.getHours(),2,"0");var mm=padStart(date.getMinutes(),2,"0");var ss=padStart(date.getSeconds(),2,"0");var mmm=padStart(date.getMilliseconds(),3,"0");// The time-zone offset is the difference, in minutes, from local time to UTC. Note that this // means that the offset is positive if the local timezone is behind UTC and negative if it is // ahead. For example, for time zone UTC+10:00, -600 will be returned. var timezoneOffset=toInteger(date.getTimezoneOffset(),0);var ts=timezoneOffset>0?"-":"+";var th=padStart(Math.floor(Math.abs(timezoneOffset)/60),2,"0");var tm=padStart(Math.abs(timezoneOffset)%60,2,"0");return"".concat(YYYY,"-").concat(MM,"-").concat(DD,"T").concat(hh,":").concat(mm,":").concat(ss,".").concat(mmm).concat(ts).concat(th,":").concat(tm);};/** * Convert array of 16 byte values to UUID string format of the form: * XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX */var byteToHex=[];for(var i=0;i<256;++i){byteToHex.push((i+0x100).toString(16).slice(1));}function unsafeStringify(arr){var offset=arguments.length>1&&arguments[1]!==undefined?arguments[1]:0;// Note: Be careful editing this code! It's been tuned for performance // and works in ways you may not expect. See https://github.com/uuidjs/uuid/pull/434 // // Note to future-self: No, you can't remove the `toLowerCase()` call. // REF: https://github.com/uuidjs/uuid/pull/677#issuecomment-1757351351 return(byteToHex[arr[offset+0]]+byteToHex[arr[offset+1]]+byteToHex[arr[offset+2]]+byteToHex[arr[offset+3]]+'-'+byteToHex[arr[offset+4]]+byteToHex[arr[offset+5]]+'-'+byteToHex[arr[offset+6]]+byteToHex[arr[offset+7]]+'-'+byteToHex[arr[offset+8]]+byteToHex[arr[offset+9]]+'-'+byteToHex[arr[offset+10]]+byteToHex[arr[offset+11]]+byteToHex[arr[offset+12]]+byteToHex[arr[offset+13]]+byteToHex[arr[offset+14]]+byteToHex[arr[offset+15]]).toLowerCase();}// Unique ID creation requires a high quality random # generator. In the browser we therefore // require the crypto API and do not support built-in fallback to lower quality random number // generators (like Math.random()). var getRandomValues;var rnds8=new Uint8Array(16);function rng(){// lazy load so that environments that need to polyfill have a chance to do so if(!getRandomValues){// getRandomValues needs to be invoked in a context where "this" is a Crypto implementation. getRandomValues=typeof crypto!=='undefined'&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto);if(!getRandomValues){throw new Error('crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported');}}return getRandomValues(rnds8);}var randomUUID=typeof crypto!=='undefined'&&crypto.randomUUID&&crypto.randomUUID.bind(crypto);var _native={randomUUID:randomUUID};function v4(options,buf,offset){if(_native.randomUUID&&!buf&&!options){return _native.randomUUID();}options=options||{};var rnds=options.random||(options.rng||rng)();// Per 4.4, set bits for version and `clock_seq_hi_and_reserved` rnds[6]=rnds[6]&0x0f|0x40;rnds[8]=rnds[8]&0x3f|0x80;// Copy bytes to buffer, if provided if(buf){offset=offset||0;for(var i=0;i<16;++i){buf[offset+i]=rnds[i];}return buf;}return unsafeStringify(rnds);}/* Copyright 2023 Adobe. All rights reserved. This file is licensed to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ /** * Wraps a validator returning the value if it is null or undefined, otherwise * it will call the original validator and return the result. * * @param {function} validator - the validator to call if the value is not null */var skipIfNull=function skipIfNull(validator){return function skipIfNullValidator(value,path){return value==null?value:validator.call(this,value,path);};};/** * Returns a new validator that calls the first validator and then calls the second * validator with the result of the first validator. The result of the second validator * is returned. * * @param {function} firstValidator - validator to call first * @param {function} secondValidator - validator to call second * @returns {function} - a new validator that calls the first and second validators */var callSequentially=function callSequentially(firstValidator,secondValidator){return function callSequentiallyValidator(value,path){return secondValidator.call(this,firstValidator.call(this,value,path),path);};};/** * Just like callSequentially, but if either validator throws an error, the errors * are collected and thrown at the end. * * @param {function} firstValidator * @param {function} secondValidator * @returns {function} */var callSequentiallyJoinErrors=function callSequentiallyJoinErrors(firstValidator,secondValidator){return function callSequentiallyJoinErrorsValidator(value,path){var _this=this;var errors=[];var newValue=[firstValidator,secondValidator].reduce(function(memo,validator){try{return validator.call(_this,memo,path);}catch(e){errors.push(e);return memo;}},value);if(errors.length){throw new Error(errors.join("\n"));}return newValue;};};/** * Chains two validators together. In addition to calling the validators in * sequence, this will also copy over methods from the base validator to the * resulting validator and include any additional methods. * * @param {function} baseValidator - This validator will be called first, and its * methods will be copied over to the returned validator. * @param {function} newValidator - This validator will be called second. * @param {object} additionalMethods - Additional methods to include on the returned * validator. * @returns {function} */var chain=function chain(baseValidator,newValidator,additionalMethods){return(0,_reactorObjectAssign["default"])(callSequentially(baseValidator,newValidator),baseValidator,additionalMethods);};/** * Chains two validators together, but skips the second validator if the value * is null. In addition to calling the validators in sequence, this will also * copy over methods from the base validator to the resulting validator and * include any additional methods. * * @param {function} baseValidator - This validator will be called first, and its * methods will be copied over to the returned validator. * @param {function} newValidator - This validator will be called second. If the value * is null after the first validator is called, this validator will not be * called. * @param {object} additionalMethods - Additional methods to include on the returned * validator. * @returns {function} */var nullSafeChain=function nullSafeChain(baseValidator,newValidator,additionalMethods){return(0,_reactorObjectAssign["default"])(callSequentially(baseValidator,skipIfNull(newValidator)),baseValidator,additionalMethods);};/** * Same as nullSafeChain, but calls the new validator first. * * @param {function} baseValidator - This validator will be called second, and its * methods will be copied over to the returned validator. * @param {function} newValidator - This validator will be called first. If the value * is null, this validator will not be called. * @param {function} additionalMethods - Additional methods to include on the returned * validator. * @returns {function} */var reverseNullSafeChainJoinErrors=function reverseNullSafeChainJoinErrors(baseValidator,newValidator,additionalMethods){return(0,_reactorObjectAssign["default"])(callSequentiallyJoinErrors(skipIfNull(newValidator),baseValidator),baseValidator,additionalMethods);};/** * Throws an error if the value is not valid. * * @param {boolean} isValid - Whether or not the value is valid. * @param {*} value - The value to validate. * @param {string} path - The path to the value. * @param {string} message - The expected part of the error message. * @throws {Error} - Throws an error if the value is not valid. * @returns {void} */var assertValid=function assertValid(isValid,value,path,message){if(!isValid){throw new Error("'".concat(path,"': Expected ").concat(message,", but got ").concat(JSON.stringify(value),"."));}};/* Copyright 2019 Adobe. All rights reserved. This file is licensed to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */var booleanValidator=function booleanValidator(value,path){assertValid(isBoolean(value),value,path,"true or false");return value;};/* Copyright 2019 Adobe. All rights reserved. This file is licensed to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */var callbackValidator=function callbackValidator(value,path){assertValid(isFunction(value),value,path,"a function");return value;};/* Copyright 2019 Adobe. All rights reserved. This file is licensed to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */var createAnyOfValidator=function createAnyOfValidator(validators,message){return function anyOf(value,path){var _this2=this;var newValue;var valid=find(validators,function(validator){try{newValue=validator.call(_this2,value,path);return true;}catch(e){return false;}});assertValid(valid,value,path,message);return newValue;};};/* Copyright 2019 Adobe. All rights reserved. This file is licensed to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */var createArrayOfValidator=function createArrayOfValidator(elementValidator){return function arrayOf(value,path){var _this3=this;assertValid(Array.isArray(value),value,path,"an array");var errors=[];var validatedArray=value.map(function(subValue,i){try{return elementValidator.call(_this3,subValue,"".concat(path,"[").concat(i,"]"),value);}catch(e){errors.push(e.message);return undefined;}});if(errors.length){throw new Error(errors.join("\n"));}return validatedArray;};};/* Copyright 2020 Adobe. All rights reserved. This file is licensed to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */var createDefaultValidator=function createDefaultValidator(defaultValue){return function(value){if(value==null){return defaultValue;}return value;};};/* Copyright 2024 Adobe. All rights reserved. This file is licensed to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */var createDeprecatedValidator=function createDeprecatedValidator(){var warning=arguments.length>0&&arguments[0]!==undefined?arguments[0]:"This field has been deprecated";return function deprecated(value,path){var message=warning;if(value!==undefined){if(path){message="'".concat(path,"': ").concat(message);}if(this&&this.logger){this.logger.warn(message);}}return value;};};/* Copyright 2020 Adobe. All rights reserved. This file is licensed to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */var createLiteralValidator=function createLiteralValidator(literalValue){return function(value,path){assertValid(value===literalValue,value,path,"".concat(literalValue));return value;};};/* Copyright 2020 Adobe. All rights reserved. This file is licensed to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */var createMapOfValuesValidator=function createMapOfValuesValidator(valueValidator){return function mapOfValues(value,path){var _this4=this;assertValid(isObject(value),value,path,"an object");var errors=[];var validatedObject={};Object.keys(value).forEach(function(subKey){var subValue=value[subKey];var subPath=path?"".concat(path,".").concat(subKey):subKey;try{var validatedValue=valueValidator.call(_this4,subValue,subPath);if(validatedValue!==undefined){validatedObject[subKey]=validatedValue;}}catch(e){errors.push(e.message);}});if(errors.length){throw new Error(errors.join("\n"));}return validatedObject;};};/* Copyright 2019 Adobe. All rights reserved. This file is licensed to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */var createMinimumValidator=function createMinimumValidator(typeName,minimum){return function(value,path){assertValid(value>=minimum,value,path,"".concat(typeName," greater than or equal to ").concat(minimum));return value;};};/* Copyright 2023 Adobe. All rights reserved. This file is licensed to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */var createMaximumValidator=function createMaximumValidator(typeName,maximum){return function(value,path){assertValid(value<=maximum,value,path,"".concat(typeName," less than or equal to ").concat(maximum));return value;};};/* Copyright 2020 Adobe. All rights reserved. This file is licensed to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */var createNoUnknownFieldsValidator=function createNoUnknownFieldsValidator(schema){return function(value,path){var errors=[];Object.keys(value).forEach(function(subKey){if(!schema[subKey]){var subPath=path?"".concat(path,".").concat(subKey):subKey;errors.push("'".concat(subPath,"': Unknown field."));}});if(errors.length){throw new Error(errors.join("\n"));}return value;};};/* Copyright 2019 Adobe. All rights reserved. This file is licensed to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */var createNonEmptyValidator=function createNonEmptyValidator(message){return function(value,path){if(isObject(value)){assertValid(!isEmptyObject(value),value,path,message);}else{assertValid(value.length>0,value,path,message);}return value;};};/* Copyright 2020 Adobe. All rights reserved. This file is licensed to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */var createObjectOfValidator=function createObjectOfValidator(schema){return function objectOf(value,path){var _this5=this;assertValid(isObject(value),value,path,"an object");var errors=[];var validatedObject={};Object.keys(schema).forEach(function(subKey){var subValue=value[subKey];var subSchema=schema[subKey];var subPath=path?"".concat(path,".").concat(subKey):subKey;try{var validatedValue=subSchema.call(_this5,subValue,subPath);if(validatedValue!==undefined){validatedObject[subKey]=validatedValue;}}catch(e){errors.push(e.message);}});// copy over unknown properties Object.keys(value).forEach(function(subKey){if(!Object.prototype.hasOwnProperty.call(validatedObject,subKey)){validatedObject[subKey]=value[subKey];}});if(errors.length){throw new Error(errors.join("\n"));}return validatedObject;};};/* Copyright 2023 Adobe. All rights reserved. This file is licensed to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */var createRenamedValidator=function createRenamedValidator(oldField,oldSchema,newField){return function deprecated(value,path){assertValid(isObject(value),value,path,"an object");var oldValue=value[oldField],newValue=value[newField],otherValues=_objectWithoutProperties(value,[oldField,newField].map(_toPropertyKey));var validatedOldValue=oldSchema(oldValue,path);if(validatedOldValue!==undefined){var message="The field '".concat(oldField,"' is deprecated. Use '").concat(newField,"' instead.");if(path){message="'".concat(path,"': ").concat(message);}if(newValue!==undefined&&newValue!==validatedOldValue){throw new Error(message);}else if(this&&this.logger){this.logger.warn(message);}}return _objectSpread(_defineProperty({},newField,newValue||validatedOldValue),otherValues);};};/* Copyright 2019 Adobe. All rights reserved. This file is licensed to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */var createUniqueValidator=function createUniqueValidator(){var values=[];return function(value,path){assertValid(values.indexOf(value)===-1,value,path,"a unique value across instances");values.push(value);return value;};};/* Copyright 2022 Adobe. All rights reserved. This file is licensed to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ /** * Returns whether an array contains unique values. * @param {*} value * @returns {boolean} */var isUnique=function isUnique(values){var storedVals=Object.create(null);for(var _i6=0;_i61&&arguments[1]!==undefined?arguments[1]:{};var conflictingCommandNames=intersection(Object.keys(commandsByName),Object.keys(componentCommandsByName));if(conflictingCommandNames.length){throw new Error("[ComponentRegistry] Could not register ".concat(namespace," ")+"because it has existing command(s): ".concat(conflictingCommandNames.join(",")));}Object.keys(componentCommandsByName).forEach(function(commandName){var command=componentCommandsByName[commandName];command.commandName=commandName;command.run=wrapForErrorHandling(command.run,"[".concat(namespace,"] An error occurred while executing the ").concat(commandName," command."));commandsByName[commandName]=command;});};var registerLifecycleCallbacks=function registerLifecycleCallbacks(namespace){var componentLifecycleCallbacksByName=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};Object.keys(componentLifecycleCallbacksByName).forEach(function(hookName){lifecycleCallbacksByName[hookName]=lifecycleCallbacksByName[hookName]||[];lifecycleCallbacksByName[hookName].push(wrapForErrorHandling(componentLifecycleCallbacksByName[hookName],"[".concat(namespace,"] An error occurred while executing the ").concat(hookName," lifecycle hook.")));});};return{register:function register(namespace,component){var commands=component.commands,lifecycle=component.lifecycle;registerComponentCommands(namespace,commands);registerLifecycleCallbacks(namespace,lifecycle);componentsByNamespace[namespace]=component;},getCommand:function getCommand(commandName){return commandsByName[commandName];},getCommandNames:function getCommandNames(){return Object.keys(commandsByName);},getLifecycleCallbacks:function getLifecycleCallbacks(hookName){return lifecycleCallbacksByName[hookName]||[];},getComponentNames:function getComponentNames(){return Object.keys(componentsByNamespace);}};};/* Copyright 2019 Adobe. All rights reserved. This file is licensed to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */var injectSendNetworkRequest=function injectSendNetworkRequest(_ref12){var logger=_ref12.logger,sendFetchRequest=_ref12.sendFetchRequest,sendBeaconRequest=_ref12.sendBeaconRequest,isRequestRetryable=_ref12.isRequestRetryable,getRequestRetryDelay=_ref12.getRequestRetryDelay;/** * Send a network request and returns details about the response. */return function(_ref13){var requestId=_ref13.requestId,url=_ref13.url,payload=_ref13.payload,useSendBeacon=_ref13.useSendBeacon;// We want to log raw payload and event data rather than // our fancy wrapper objects. Calling payload.toJSON() is // insufficient to get all the nested raw data, because it's // not recursive (it doesn't call toJSON() on the event objects). // Parsing the result of JSON.stringify(), however, gives the // fully recursive raw data. var stringifiedPayload=JSON.stringify(payload);var parsedPayload=JSON.parse(stringifiedPayload);logger.logOnBeforeNetworkRequest({url:url,requestId:requestId,payload:parsedPayload});var executeRequest=function executeRequest(){var retriesAttempted=arguments.length>0&&arguments[0]!==undefined?arguments[0]:0;var requestMethod=useSendBeacon?sendBeaconRequest:sendFetchRequest;return requestMethod(url,stringifiedPayload).then(function(response){var requestIsRetryable=isRequestRetryable({response:response,retriesAttempted:retriesAttempted});if(requestIsRetryable){var requestRetryDelay=getRequestRetryDelay({response:response,retriesAttempted:retriesAttempted});return new Promise(function(resolve){setTimeout(function(){resolve(executeRequest(retriesAttempted+1));},requestRetryDelay);});}var parsedBody;try{parsedBody=JSON.parse(response.body);}catch(e){// Non-JSON. Something went wrong. }logger.logOnNetworkResponse(_objectSpread(_objectSpread({requestId:requestId,url:url,payload:parsedPayload},response),{},{parsedBody:parsedBody,retriesAttempted:retriesAttempted}));return{statusCode:response.statusCode,body:response.body,parsedBody:parsedBody,getHeader:response.getHeader};});};return executeRequest()["catch"](function(error){logger.logOnNetworkError({requestId:requestId,url:url,payload:parsedPayload,error:error});throw stackError({error:error,message:"Network request failed."});});};};/* Copyright 2021 Adobe. All rights reserved. This file is licensed to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */var injectExtractEdgeInfo=function injectExtractEdgeInfo(_ref14){var logger=_ref14.logger;return function(adobeEdgeHeader){if(adobeEdgeHeader){var headerParts=adobeEdgeHeader.split(";");if(headerParts.length>=2&&headerParts[1].length>0){try{var regionId=parseInt(headerParts[1],10);// eslint recommends using Number.isNaN instead, but this function is // not available in Internet Explorer. Number.isNaN is more robust to // non-numeric parameters. Since we already know regionId will be an // integer, using isNaN is okay. // https://github.com/airbnb/javascript#standard-library--isnan // eslint-disable-next-line no-restricted-globals if(!isNaN(regionId)){return{regionId:regionId};}}catch(e){// No need to do anything. The log statement below will log an error }}logger.warn("Invalid adobe edge: \"".concat(adobeEdgeHeader,"\""));}return{};};};/* Copyright 2020 Adobe. All rights reserved. This file is licensed to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */var IN="in";var OUT="out";var PENDING="pending";/* Copyright 2020 Adobe. All rights reserved. This file is licensed to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */var GENERAL="general";/* Copyright 2020 Adobe. All rights reserved. This file is licensed to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */var DECLINED_CONSENT_ERROR_CODE="declinedConsent";var CONSENT_SOURCE_DEFAULT="default";var CONSENT_SOURCE_INITIAL="initial";var CONSENT_SOURCE_NEW="new";var createDeclinedConsentError=function createDeclinedConsentError(errorMessage){var error=new Error(errorMessage);error.code=DECLINED_CONSENT_ERROR_CODE;error.message=errorMessage;return error;};var createConsentStateMachine=function createConsentStateMachine(_ref15){var logger=_ref15.logger;var deferreds=[];var runAll=function runAll(){while(deferreds.length){deferreds.shift().resolve();}};var discardAll=function discardAll(){while(deferreds.length){deferreds.shift().reject(createDeclinedConsentError("The user declined consent."));}};var awaitInitial=function awaitInitial(){return Promise.reject(new Error("Consent has not been initialized."));};var awaitInDefault=function awaitInDefault(){return Promise.resolve();};var awaitIn=function awaitIn(){return Promise.resolve();};var awaitOutDefault=function awaitOutDefault(){return Promise.reject(createDeclinedConsentError("No consent preferences have been set."));};var awaitOut=function awaitOut(){return Promise.reject(createDeclinedConsentError("The user declined consent."));};var awaitPending=function awaitPending(returnImmediately){if(returnImmediately){return Promise.reject(new Error("Consent is pending."));}var deferred=defer();deferreds.push(deferred);return deferred.promise;};return{"in":function _in(source){if(source===CONSENT_SOURCE_DEFAULT){this.awaitConsent=awaitInDefault;}else{if(source===CONSENT_SOURCE_INITIAL){logger.info("Loaded user consent preferences. The user previously consented.");}else if(source===CONSENT_SOURCE_NEW&&this.awaitConsent!==awaitIn){logger.info("User consented.");}runAll();this.awaitConsent=awaitIn;}},out:function out(source){if(source===CONSENT_SOURCE_DEFAULT){logger.warn("User consent preferences not found. Default consent of out will be used.");this.awaitConsent=awaitOutDefault;}else{if(source===CONSENT_SOURCE_INITIAL){logger.warn("Loaded user consent preferences. The user previously declined consent.");}else if(source===CONSENT_SOURCE_NEW&&this.awaitConsent!==awaitOut){logger.warn("User declined consent.");}discardAll();this.awaitConsent=awaitOut;}},pending:function pending(source){if(source===CONSENT_SOURCE_DEFAULT){logger.info("User consent preferences not found. Default consent of pending will be used. Some commands may be delayed.");}this.awaitConsent=awaitPending;},awaitConsent:awaitInitial,withConsent:function withConsent(){return this.awaitConsent(true);},current:function current(){switch(this.awaitConsent){case awaitInDefault:return{state:"in",wasSet:false};case awaitIn:return{state:"in",wasSet:true};case awaitOutDefault:return{state:"out",wasSet:false};case awaitOut:return{state:"out",wasSet:true};case awaitPending:return{state:"pending",wasSet:false};default:return{state:"in",wasSet:false};}}};};/* Copyright 2020 Adobe. All rights reserved. This file is licensed to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */var createConsent=function createConsent(_ref16){var generalConsentState=_ref16.generalConsentState,logger=_ref16.logger;var _setConsent=function setConsent(consentByPurpose,source){switch(consentByPurpose[GENERAL]){case IN:generalConsentState["in"](source);break;case OUT:generalConsentState.out(source);break;case PENDING:generalConsentState.pending(source);break;default:logger.warn("Unknown consent value: ".concat(consentByPurpose[GENERAL]));break;}};return{initializeConsent:function initializeConsent(defaultConsentByPurpose,storedConsentByPurpose){if(storedConsentByPurpose[GENERAL]){_setConsent(storedConsentByPurpose,CONSENT_SOURCE_INITIAL);}else{_setConsent(defaultConsentByPurpose,CONSENT_SOURCE_DEFAULT);}},setConsent:function setConsent(consentByPurpose){_setConsent(consentByPurpose,CONSENT_SOURCE_NEW);},suspend:function suspend(){generalConsentState.pending();},awaitConsent:function awaitConsent(){return generalConsentState.awaitConsent();},withConsent:function withConsent(){return generalConsentState.withConsent();},current:function current(){return generalConsentState.current();}};};/* Copyright 2019 Adobe. All rights reserved. This file is licensed to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */var getXdmPropositions=function getXdmPropositions(xdm){return xdm&&// eslint-disable-next-line no-underscore-dangle xdm._experience&&// eslint-disable-next-line no-underscore-dangle xdm._experience.decisioning&&// eslint-disable-next-line no-underscore-dangle isNonEmptyArray(xdm._experience.decisioning.propositions)?// eslint-disable-next-line no-underscore-dangle xdm._experience.decisioning.propositions:[];};var createEvent=function createEvent(){var content={};var userXdm;var userData;var _documentMayUnload=false;var isFinalized=false;var shouldSendEvent=true;var throwIfEventFinalized=function throwIfEventFinalized(methodName){if(isFinalized){throw new Error("".concat(methodName," cannot be called after event is finalized."));}};var event={hasQuery:function hasQuery(){return Object.prototype.hasOwnProperty.call(this.getContent(),"query");},getContent:function getContent(){var currentContent=JSON.parse(JSON.stringify(content));if(userXdm){deepAssign(currentContent,{xdm:userXdm});}if(userData){deepAssign(currentContent,{data:userData});}return currentContent;},setUserXdm:function setUserXdm(value){throwIfEventFinalized("setUserXdm");userXdm=value;},setUserData:function setUserData(value){throwIfEventFinalized("setUserData");userData=value;},mergeXdm:function mergeXdm(xdm){throwIfEventFinalized("mergeXdm");if(xdm){deepAssign(content,{xdm:xdm});}},mergeData:function mergeData(data){throwIfEventFinalized("mergeData");if(data){deepAssign(content,{data:data});}},mergeMeta:function mergeMeta(meta){throwIfEventFinalized("mergeMeta");if(meta){deepAssign(content,{meta:meta});}},mergeQuery:function mergeQuery(query){throwIfEventFinalized("mergeQuery");if(query){deepAssign(content,{query:query});}},documentMayUnload:function documentMayUnload(){_documentMayUnload=true;},finalize:function finalize(onBeforeEventSend){if(isFinalized){return;}var newPropositions=deduplicateArray([].concat(_toConsumableArray(getXdmPropositions(userXdm)),_toConsumableArray(getXdmPropositions(content.xdm))),function(a,b){return a===b||a.id&&b.id&&a.id===b.id&&a.scope&&b.scope&&a.scope===b.scope;});if(userXdm){this.mergeXdm(userXdm);}if(newPropositions.length>0){// eslint-disable-next-line no-underscore-dangle content.xdm._experience.decisioning.propositions=newPropositions;}if(userData){event.mergeData(userData);}// the event should already be considered finalized in case onBeforeEventSend throws an error isFinalized=true;if(onBeforeEventSend){// assume that the onBeforeEventSend callback will fail (in-case of an error) shouldSendEvent=false;// this allows the user to replace the xdm and data properties // on the object passed to the callback var tempContent={xdm:content.xdm||{},data:content.data||{}};var result=onBeforeEventSend(tempContent);shouldSendEvent=result!==false;content.xdm=tempContent.xdm||{};content.data=tempContent.data||{};if(isEmptyObject(content.xdm)){delete content.xdm;}if(isEmptyObject(content.data)){delete content.data;}}},getDocumentMayUnload:function getDocumentMayUnload(){return _documentMayUnload;},isEmpty:function isEmpty(){return isEmptyObject(content)&&(!userXdm||isEmptyObject(userXdm))&&(!userData||isEmptyObject(userData));},shouldSend:function shouldSend(){return shouldSendEvent;},getViewName:function getViewName(){if(!userXdm||!userXdm.web||!userXdm.web.webPageDetails){return undefined;}return userXdm.web.webPageDetails.viewName;},toJSON:function toJSON(){if(!isFinalized){throw new Error("toJSON called before finalize");}return content;}};return event;};/* Copyright 2021 Adobe. All rights reserved. This file is licensed to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */var RETRY_AFTER="Retry-After";var ADOBE_EDGE="x-adobe-edge";/* Copyright 2019 Adobe. All rights reserved. This file is licensed to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ /** * Creates a representation of a gateway response with the addition of * helper methods. * @returns Response */var injectCreateResponse=function injectCreateResponse(_ref17){var extractEdgeInfo=_ref17.extractEdgeInfo;return function(_ref18){var _ref18$content=_ref18.content,content=_ref18$content===void 0?{}:_ref18$content,getHeader=_ref18.getHeader;var _content$handle=content.handle,handle=_content$handle===void 0?[]:_content$handle,_content$errors=content.errors,errors=_content$errors===void 0?[]:_content$errors,_content$warnings=content.warnings,warnings=_content$warnings===void 0?[]:_content$warnings;/** * Response object. * @typedef {Object} Response */return{/** * Returns matching fragments of the response by type. * @param {String} type A string with the current format: * * @example * getPayloadsByType("identity:persist") */getPayloadsByType:function getPayloadsByType(type){return flatMap(handle.filter(function(fragment){return fragment.type===type;}),function(fragment){return fragment.payload;});},/** * Returns all errors. */getErrors:function getErrors(){return errors;},/** * Returns all warnings. */getWarnings:function getWarnings(){return warnings;},/** * Returns an object containing the regionId from the x-adobe-edge header */getEdge:function getEdge(){return extractEdgeInfo(getHeader(ADOBE_EDGE));},toJSON:function toJSON(){return content;}};};};/* Copyright 2020 Adobe. All rights reserved. This file is licensed to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */var CONFIGURE="configure";var SET_DEBUG="setDebug";/* Copyright 2019 Adobe. All rights reserved. This file is licensed to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */var injectExecuteCommand=function injectExecuteCommand(_ref19){var logger=_ref19.logger,configureCommand=_ref19.configureCommand,setDebugCommand=_ref19.setDebugCommand,handleError=_ref19.handleError,validateCommandOptions=_ref19.validateCommandOptions;var configurePromise;var getExecutor=function getExecutor(commandName,options){var executor;if(commandName===CONFIGURE){if(configurePromise){throw new Error("The library has already been configured and may only be configured once.");}executor=function executor(){configurePromise=configureCommand(options);return configurePromise.then(function(){// Don't expose internals to the user. });};}else{if(!configurePromise){throw new Error("The library must be configured first. Please do so by executing the configure command.");}if(commandName===SET_DEBUG){executor=function executor(){return setDebugCommand(options);};}else{executor=function executor(){return configurePromise.then(function(componentRegistry){var command=componentRegistry.getCommand(commandName);if(!command||!isFunction(command.run)){var commandNames=[CONFIGURE,SET_DEBUG].concat(componentRegistry.getCommandNames()).join(", ");throw new Error("The ".concat(commandName," command does not exist. List of available commands: ").concat(commandNames,"."));}var validatedOptions=validateCommandOptions({command:command,options:options});return command.run(validatedOptions);},function(){logger.warn("An error during configuration is preventing the ".concat(commandName," command from executing."));// If configuration failed, we prevent the configuration // error from bubbling here because we don't want the // configuration error to be reported in the console every // time any command is executed. Only having it bubble // once when the configure command runs is sufficient. // Instead, for this command, we'll just return a promise // that never gets resolved. return new Promise(function(){});});};}}return executor;};return function(commandName){var options=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};return new Promise(function(resolve){// We have to wrap the getExecutor() call in the promise so the promise // will be rejected if getExecutor() throws errors. var executor=getExecutor(commandName,options);logger.logOnBeforeCommand({commandName:commandName,options:options});resolve(executor());})["catch"](function(error){return handleError(error,"".concat(commandName," command"));})["catch"](function(error){logger.logOnCommandRejected({commandName:commandName,options:options,error:error});throw error;}).then(function(rawResult){// We should always be returning an object from every command. var result=isObject(rawResult)?rawResult:{};logger.logOnCommandResolved({commandName:commandName,options:options,result:result});return result;});};};/* Copyright 2020 Adobe. All rights reserved. This file is licensed to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */var COMMAND_DOC_URI="https://adobe.ly/3sHgQHb";var validateCommandOptions=function validateCommandOptions(_ref20){var command=_ref20.command,options=_ref20.options;var commandName=command.commandName,_command$documentatio=command.documentationUri,documentationUri=_command$documentatio===void 0?COMMAND_DOC_URI:_command$documentatio,optionsValidator=command.optionsValidator;var validatedOptions=options;if(optionsValidator){try{validatedOptions=optionsValidator(options);}catch(validationError){var invalidOptionsMessage="Invalid ".concat(commandName," command options:\n\t - ").concat(validationError," For command documentation see: ").concat(documentationUri);throw new Error(invalidOptionsMessage);}}return validatedOptions;};/* Copyright 2020 Adobe. All rights reserved. This file is licensed to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ /** * Verifies user provided event options. * @param {*} options The user event options to validate * @returns {*} Validated options */var validateUserEventOptions=function validateUserEventOptions(_ref21){var options=_ref21.options;var eventOptionsValidator=boundObjectOf({type:boundString(),xdm:boundObjectOf({eventType:boundString(),identityMap:validateIdentityMap}),data:boundObjectOf({}),documentUnloading:boundBoolean(),renderDecisions:boundBoolean(),decisionScopes:boundArrayOf(boundString()).uniqueItems(),personalization:boundObjectOf({decisionScopes:boundArrayOf(boundString()).uniqueItems(),surfaces:boundArrayOf(boundString()).uniqueItems(),sendDisplayEvent:boundBoolean()["default"](true),includeRenderedPropositions:boundBoolean()["default"](false),defaultPersonalizationEnabled:boundBoolean(),decisionContext:boundObjectOf({})})["default"]({sendDisplayEvent:true}),datasetId:boundString(),mergeId:boundString(),edgeConfigOverrides:validateConfigOverride,initializePersonalization:boundBoolean()}).required().noUnknownFields();return eventOptionsValidator(options);};/* Copyright 2023 Adobe. All rights reserved. This file is licensed to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */var validateApplyResponse=function validateApplyResponse(_ref22){var options=_ref22.options;var validator=boundObjectOf({renderDecisions:boundBoolean(),responseHeaders:boundMapOfValues(boundString().required()),responseBody:boundObjectOf({handle:boundArrayOf(boundObjectOf({type:boundString().required(),payload:boundAnything().required()})).required()}).required(),personalization:boundObjectOf({sendDisplayEvent:boundBoolean()["default"](true),decisionContext:boundObjectOf({})})["default"]({sendDisplayEvent:true})}).noUnknownFields();return validator(options);};/* Copyright 2019 Adobe. All rights reserved. This file is licensed to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */var createDataCollector=function createDataCollector(_ref23){var eventManager=_ref23.eventManager,logger=_ref23.logger;return{commands:{sendEvent:{documentationUri:"https://adobe.ly/3GQ3Q7t",optionsValidator:function optionsValidator(options){return validateUserEventOptions({options:options});},run:function run(options){var xdm=options.xdm,data=options.data,documentUnloading=options.documentUnloading,type=options.type,mergeId=options.mergeId,datasetId=options.datasetId,edgeConfigOverrides=options.edgeConfigOverrides,eventManagerOptions=_objectWithoutProperties(options,_excluded);var event=eventManager.createEvent();if(documentUnloading){event.documentMayUnload();}event.setUserXdm(xdm);event.setUserData(data);if(type){event.mergeXdm({eventType:type});}if(mergeId){event.mergeXdm({eventMergeId:mergeId});}if(edgeConfigOverrides){eventManagerOptions.edgeConfigOverrides=edgeConfigOverrides;}if(datasetId){logger.warn("The 'datasetId' option has been deprecated. Please use 'edgeConfigOverrides.com_adobe_experience_platform.datasets.event.datasetId' instead.");eventManagerOptions.edgeConfigOverrides=edgeConfigOverrides||{};deepAssign(eventManagerOptions.edgeConfigOverrides,{com_adobe_experience_platform:{datasets:{event:{datasetId:datasetId}}}});}return eventManager.sendEvent(event,eventManagerOptions);}},applyResponse:{documentationUri:"",optionsValidator:function optionsValidator(options){return validateApplyResponse({options:options});},run:function run(options){var _options$renderDecisi=options.renderDecisions,renderDecisions=_options$renderDecisi===void 0?false:_options$renderDecisi,_options$decisionCont=options.decisionContext,decisionContext=_options$decisionCont===void 0?{}:_options$decisionCont,_options$responseHead=options.responseHeaders,responseHeaders=_options$responseHead===void 0?{}:_options$responseHead,_options$responseBody=options.responseBody,responseBody=_options$responseBody===void 0?{handle:[]}:_options$responseBody,personalization=options.personalization;var event=eventManager.createEvent();return eventManager.applyResponse(event,{renderDecisions:renderDecisions,decisionContext:decisionContext,responseHeaders:responseHeaders,responseBody:responseBody,personalization:personalization});}}}};};createDataCollector.namespace="DataCollector";/* Copyright 2022 Adobe. All rights reserved. This file is licensed to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */var createClickHandler=function createClickHandler(_ref24){var eventManager=_ref24.eventManager,lifecycle=_ref24.lifecycle,handleError=_ref24.handleError;return function(clickEvent){// Ignore repropagated clicks from AppMeasurement if(clickEvent.s_fe){return Promise.resolve();}// TODO: Consider safeguarding from the same object being clicked multiple times in rapid succession? var clickedElement=clickEvent.target;var event=eventManager.createEvent();// this is to make sure a exit link personalization metric use send beacon event.documentMayUnload();return lifecycle.onClick({event:event,clickedElement:clickedElement}).then(function(){if(event.isEmpty()){return Promise.resolve();}return eventManager.sendEvent(event);})// eventManager.sendEvent() will return a promise resolved to an // object and we want to avoid returning any value to the customer .then(noop)["catch"](function(error){handleError(error,"click collection");});};};var attachClickActivityCollector=function attachClickActivityCollector(_ref25){var eventManager=_ref25.eventManager,lifecycle=_ref25.lifecycle,handleError=_ref25.handleError;var clickHandler=createClickHandler({eventManager:eventManager,lifecycle:lifecycle,handleError:handleError});document.addEventListener("click",clickHandler,true);};/* Copyright 2019 Adobe. All rights reserved. This file is licensed to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */var downloadLinkQualifier=boundString().regexp()["default"]("\\.(exe|zip|wav|mp3|mov|mpg|avi|wmv|pdf|doc|docx|xls|xlsx|ppt|pptx)$");var configValidators$2=boundObjectOf({clickCollectionEnabled:boundBoolean()["default"](true),clickCollection:boundObjectOf({internalLinkEnabled:boundBoolean()["default"](true),externalLinkEnabled:boundBoolean()["default"](true),downloadLinkEnabled:boundBoolean()["default"](true),// TODO: Consider moving downloadLinkQualifier here. sessionStorageEnabled:boundBoolean()["default"](false),eventGroupingEnabled:boundBoolean()["default"](false),filterClickProperties:boundCallback()})["default"]({internalLinkEnabled:true,externalLinkEnabled:true,downloadLinkEnabled:true,sessionStorageEnabled:false,eventGroupingEnabled:false}),downloadLinkQualifier:downloadLinkQualifier,onBeforeLinkClickSend:boundCallback().deprecated('The field "onBeforeLinkClickSend" has been deprecated. Use "clickCollection.filterClickDetails" instead.')});/* Copyright 2024 Adobe. All rights reserved. This file is licensed to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */var ACTIVITY_MAP_EXTENSION_ID="cppXYctnr";var activityMapExtensionEnabled=function activityMapExtensionEnabled(){var context=arguments.length>0&&arguments[0]!==undefined?arguments[0]:document;return context.getElementById(ACTIVITY_MAP_EXTENSION_ID)!==null;};/* Copyright 2024 Adobe. All rights reserved. This file is licensed to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */var extractDomain=function extractDomain(uri){var fullUrl=uri;if(!/^https?:\/\//i.test(fullUrl)){fullUrl="".concat(window.location.protocol,"//").concat(uri);}var url=new URL(fullUrl);return url.hostname;};/* Copyright 2024 Adobe. All rights reserved. This file is licensed to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */var isDifferentDomains=function isDifferentDomains(uri1,uri2){var domain1=extractDomain(uri1);var domain2=extractDomain(uri2);return domain1!==domain2;};/* Copyright 2022 Adobe. All rights reserved. This file is licensed to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */var isDissallowedLinkType=function isDissallowedLinkType(clickCollection,linkType){return linkType&&(linkType==="download"&&!clickCollection.downloadLinkEnabled||linkType==="exit"&&!clickCollection.externalLinkEnabled||linkType==="other"&&!clickCollection.internalLinkEnabled);};var createInjectClickedElementProperties=function createInjectClickedElementProperties(_ref26){var config=_ref26.config,logger=_ref26.logger,getClickedElementProperties=_ref26.getClickedElementProperties,clickActivityStorage=_ref26.clickActivityStorage;var clickCollectionEnabled=config.clickCollectionEnabled,clickCollection=config.clickCollection;if(!clickCollectionEnabled){return function(){return undefined;};}return function(_ref27){var event=_ref27.event,clickedElement=_ref27.clickedElement;var elementProperties=getClickedElementProperties({clickActivityStorage:clickActivityStorage,clickedElement:clickedElement,config:config,logger:logger});var linkType=elementProperties.linkType;// Avoid clicks to be collected for the ActivityMap interface if(activityMapExtensionEnabled()){return;}if(elementProperties.isValidLink()&&isDissallowedLinkType(clickCollection,linkType)){logger.info("Cancelling link click event due to clickCollection.".concat(linkType,"LinkEnabled = false."));}else if(// Determine if element properties should be sent with event now, or be saved // and grouped with a future page view event. // Event grouping is not supported for the deprecated onBeforeLinkClickSend callback // because only click properties is saved and not XDM and DATA (which could have been modified). // However, if the filterClickDetails callback is available we group events because it takes // priority over onBeforeLinkClickSend and only supports processing click properties. elementProperties.isInternalLink()&&clickCollection.eventGroupingEnabled&&(!config.onBeforeLinkClickSend||clickCollection.filterClickDetails)&&!isDifferentDomains(window.location.hostname,elementProperties.linkUrl)){clickActivityStorage.save(elementProperties.properties);}else if(elementProperties.isValidLink()){// Event will be sent event.mergeXdm(elementProperties.xdm);event.mergeData(elementProperties.data);clickActivityStorage.save({pageName:elementProperties.pageName,pageIDType:elementProperties.pageIDType});}else if(elementProperties.isValidActivityMapData()){clickActivityStorage.save(elementProperties.properties);}};};/* Copyright 2022 Adobe. All rights reserved. This file is licensed to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */var buildXdmFromClickedElementProperties=function buildXdmFromClickedElementProperties(props){return{eventType:"web.webinteraction.linkClicks",web:{webInteraction:{name:props.linkName,region:props.linkRegion,type:props.linkType,URL:props.linkUrl,linkClicks:{value:1}}}};};var buildDataFromClickedElementProperties=function buildDataFromClickedElementProperties(props){return{__adobe:{analytics:{contextData:{a:{activitymap:{page:props.pageName,link:props.linkName,region:props.linkRegion,pageIDType:props.pageIDType}}}}}};};var populateClickedElementPropertiesFromOptions=function populateClickedElementPropertiesFromOptions(options,props){var xdm=options.xdm,data=options.data,clickedElement=options.clickedElement;props.clickedElement=clickedElement;if(xdm&&xdm.web&&xdm.web.webInteraction){var _xdm$web$webInteracti=xdm.web.webInteraction,name=_xdm$web$webInteracti.name,region=_xdm$web$webInteracti.region,type=_xdm$web$webInteracti.type,_URL=_xdm$web$webInteracti.URL;props.linkName=name;props.linkRegion=region;props.linkType=type;props.linkUrl=_URL;}// DATA has priority over XDM /* eslint no-underscore-dangle: 0 */if(data&&data.__adobe&&data.__adobe.analytics){var contextData=data.__adobe.analytics.contextData;if(contextData&&contextData.a&&contextData.a.activitymap){// Set the properties if they exists var _contextData$a$activi=contextData.a.activitymap,page=_contextData$a$activi.page,link=_contextData$a$activi.link,_region=_contextData$a$activi.region,pageIDType=_contextData$a$activi.pageIDType;props.pageName=page||props.pageName;props.linkName=link||props.linkName;props.linkRegion=_region||props.linkRegion;if(pageIDType!==undefined){props.pageIDType=pageIDType;}}}};var createClickedElementProperties=function createClickedElementProperties(){var _ref28=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{},properties=_ref28.properties,logger=_ref28.logger;var props=properties||{};var clickedElementProperties={get pageName(){return props.pageName;},set pageName(value){props.pageName=value;},get linkName(){return props.linkName;},set linkName(value){props.linkName=value;},get linkRegion(){return props.linkRegion;},set linkRegion(value){props.linkRegion=value;},get linkType(){return props.linkType;},set linkType(value){props.linkType=value;},get linkUrl(){return props.linkUrl;},set linkUrl(value){props.linkUrl=value;},get pageIDType(){return props.pageIDType;},set pageIDType(value){props.pageIDType=value;},get clickedElement(){return props.clickedElement;},set clickedElement(value){props.clickedElement=value;},get properties(){return{pageName:props.pageName,linkName:props.linkName,linkRegion:props.linkRegion,linkType:props.linkType,linkUrl:props.linkUrl,pageIDType:props.pageIDType};},isValidLink:function isValidLink(){return!!props.linkUrl&&!!props.linkType&&!!props.linkName&&!!props.linkRegion;},isInternalLink:function isInternalLink(){return this.isValidLink()&&props.linkType==="other";},isValidActivityMapData:function isValidActivityMapData(){return!!props.pageName&&!!props.linkName&&!!props.linkRegion&&props.pageIDType!==undefined;},get xdm(){if(props.filteredXdm){return props.filteredXdm;}return buildXdmFromClickedElementProperties(this);},get data(){if(props.filteredData){return props.filteredData;}return buildDataFromClickedElementProperties(this);},applyPropertyFilter:function applyPropertyFilter(filter){if(filter&&filter(props)===false){if(logger){logger.info("Clicked element properties were rejected by filter function: ".concat(JSON.stringify(this.properties,null,2)));}props={};}},applyOptionsFilter:function applyOptionsFilter(filter){var opts=this.options;if(opts&&opts.clickedElement&&(opts.xdm||opts.data)){// Properties are rejected if filter is explicitly false. if(filter&&filter(opts)===false){if(logger){logger.info("Clicked element properties were rejected by filter function: ".concat(JSON.stringify(this.properties,null,2)));}this.options=undefined;return;}this.options=opts;// This is just to ensure that any fields outside clicked element properties // set by the user filter persists. props.filteredXdm=opts.xdm;props.filteredData=opts.data;}},get options(){var opts={};if(this.isValidLink()){opts.xdm=this.xdm;}if(this.isValidActivityMapData()){opts.data=this.data;}if(this.clickedElement){opts.clickedElement=this.clickedElement;}if(!opts.xdm&&!opts.data){return undefined;}return opts;},set options(value){props={};if(value){populateClickedElementPropertiesFromOptions(value,props);}}};return clickedElementProperties;};/* Copyright 2024 Adobe. All rights reserved. This file is licensed to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */var createRecallAndInjectClickedElementProperties=function createRecallAndInjectClickedElementProperties(_ref29){var clickActivityStorage=_ref29.clickActivityStorage;return function(event){// Avoid clicks to be collected for the ActivityMap interface if(activityMapExtensionEnabled()){return;}var properties=clickActivityStorage.load();var elementProperties=createClickedElementProperties({properties:properties});if(elementProperties.isValidLink()||elementProperties.isValidActivityMapData()){if(elementProperties.isValidLink()){var xdm=elementProperties.xdm;// Have to delete the eventType not to override the page view delete xdm.eventType;event.mergeXdm(xdm);}if(elementProperties.isValidActivityMapData()){event.mergeData(elementProperties.data);}// NOTE: We can't clear out all the storage here because we might still need to // keep a page-name for multiple link-clicks (e.g. downloads) on the same page. clickActivityStorage.save({pageName:elementProperties.pageName,pageIDType:elementProperties.pageIDType});}};};/* Copyright 2022 Adobe. All rights reserved. This file is licensed to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */var createGetClickedElementProperties=function createGetClickedElementProperties(_ref30){var window=_ref30.window,getLinkName=_ref30.getLinkName,getLinkRegion=_ref30.getLinkRegion,getAbsoluteUrlFromAnchorElement=_ref30.getAbsoluteUrlFromAnchorElement,findClickableElement=_ref30.findClickableElement,determineLinkType=_ref30.determineLinkType;return function(_ref31){var clickedElement=_ref31.clickedElement,config=_ref31.config,logger=_ref31.logger,clickActivityStorage=_ref31.clickActivityStorage;var optionsFilter=config.onBeforeLinkClickSend,clickCollection=config.clickCollection;var propertyFilter=clickCollection.filterClickDetails;var elementProperties=createClickedElementProperties({logger:logger});if(clickedElement){var clickableElement=findClickableElement(clickedElement);if(clickableElement){elementProperties.clickedElement=clickedElement;elementProperties.linkUrl=getAbsoluteUrlFromAnchorElement(window,clickableElement);elementProperties.linkType=determineLinkType(window,config,elementProperties.linkUrl,clickableElement);elementProperties.linkRegion=getLinkRegion(clickableElement);elementProperties.linkName=getLinkName(clickableElement);elementProperties.pageIDType=0;elementProperties.pageName=window.location.href;// Check if we have a page-name stored from an earlier page view event var storedLinkData=clickActivityStorage.load();if(storedLinkData&&storedLinkData.pageName){elementProperties.pageName=storedLinkData.pageName;// Perhaps pageIDType should be established after customer filter is applied // Like if pageName starts with "http" then pageIDType = 0 elementProperties.pageIDType=1;}// If defined, run user provided filter function if(propertyFilter){// clickCollection.filterClickDetails elementProperties.applyPropertyFilter(propertyFilter);}else if(optionsFilter){// onBeforeLinkClickSend elementProperties.applyOptionsFilter(optionsFilter);}}}return elementProperties;};};/* Copyright 2024 Adobe. All rights reserved. This file is licensed to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */var CLICK_ACTIVITY_DATA="clickData";/* Copyright 2024 Adobe. All rights reserved. This file is licensed to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */var createClickActivityStorage=function createClickActivityStorage(_ref32){var storage=_ref32.storage;return{save:function save(data){var jsonData=JSON.stringify(data);storage.setItem(CLICK_ACTIVITY_DATA,jsonData);},load:function load(){var jsonData=null;var data=storage.getItem(CLICK_ACTIVITY_DATA);if(data){jsonData=JSON.parse(data);}return jsonData;},remove:function remove(){storage.removeItem(CLICK_ACTIVITY_DATA);}};};/* Copyright 2024 Adobe. All rights reserved. This file is licensed to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */var createStorePageViewProperties=function createStorePageViewProperties(_ref33){var clickActivityStorage=_ref33.clickActivityStorage;return function(event){clickActivityStorage.save({pageName:event.getContent().xdm.web.webPageDetails.name,pageIDType:1// 1 = name, 0 = URL });};};/* Copyright 2024 Adobe. All rights reserved. This file is licensed to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ /** * Reduces repeated whitespace within a string. Whitespace surrounding the string * is trimmed and any occurrence of whitespace within the string is replaced with * a single space. * @param {string} str String to be formatted. * @returns {string} Formatted string. */var truncateWhiteSpace=function truncateWhiteSpace(str){return str&&str.replace(/\s+/g," ").trim();};/* Copyright 2024 Adobe. All rights reserved. This file is licensed to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */var unsupportedNodeNames=/^(SCRIPT|STYLE|LINK|CANVAS|NOSCRIPT|#COMMENT)$/i;/** * Determines if a node qualifies as a supported link text node. * @param {*} node Node to determine support for. * @returns {boolean} */var isSupportedTextNode=function isSupportedTextNode(node){if(node&&node.nodeName){if(node.nodeName.match(unsupportedNodeNames)){return false;}}return true;};/* Copyright 2022 Adobe. All rights reserved. This file is licensed to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ /** * Orders and returns specified node and its child nodes in arrays of supported * and unsupported nodes. * @param {*} node The node to extract supported and unsupported nodes from. * @returns {{supportedNodes: Array, includesUnsupportedNodes: boolean}} Node support object. */var extractSupportedNodes=function extractSupportedNodes(node){var supportedNodes=[];var includesUnsupportedNodes=false;if(isSupportedTextNode(node)){supportedNodes.push(node);if(node.childNodes){var childNodes=Array.prototype.slice.call(node.childNodes);childNodes.forEach(function(childNode){var nodes=extractSupportedNodes(childNode);supportedNodes=supportedNodes.concat(nodes.supportedNodes);includesUnsupportedNodes=includesUnsupportedNodes||nodes.includesUnsupportedNodes;});}}else{includesUnsupportedNodes=true;}return{supportedNodes:supportedNodes,includesUnsupportedNodes:includesUnsupportedNodes};};/** * Returns the value of a node attribute. * @param {*} node The node holding the attribute. * @param {string} attributeName The name of the attribute. * @param {string} nodeName Optional node name constraint. * @returns {string} Attribute value or undefined. */var getNodeAttributeValue=function getNodeAttributeValue(node,attributeName,nodeName){var attributeValue;if(!nodeName||nodeName===node.nodeName.toUpperCase()){attributeValue=node.getAttribute(attributeName);}return attributeValue;};/** * Extracts the children supported nodes attributes map * @param {*} nodes The nodes array holding the children nodes. * The returned map contains the supported not empty children attributes values. * */var getChildrenAttributes=function getChildrenAttributes(nodes){var attributes={texts:[]};nodes.supportedNodes.forEach(function(supportedNode){if(supportedNode.getAttribute){if(!attributes.alt){attributes.alt=truncateWhiteSpace(supportedNode.getAttribute("alt"));}if(!attributes.title){attributes.title=truncateWhiteSpace(supportedNode.getAttribute("title"));}if(!attributes.inputValue){attributes.inputValue=truncateWhiteSpace(getNodeAttributeValue(supportedNode,"value","INPUT"));}if(!attributes.imgSrc){attributes.imgSrc=truncateWhiteSpace(getNodeAttributeValue(supportedNode,"src","IMG"));}}if(supportedNode.nodeValue){attributes.texts.push(supportedNode.nodeValue);}});return attributes;};/** * Extracts a link-name from a given node. * * The returned link-name is set to one of the following (in order of priority): * * 1. Clicked node innerText * 2. Clicked node textContent * 3. Clicked node and its child nodes nodeValue appended together. * 4. Clicked node alt attribute or node descendant alt attribute. * Whichever is found first. * 5. Clicked node text attribute or node descendant text attribute. * Whichever is found first. * 6. Clicked node INPUT descendant value attribute. * Whichever is found first. * 7. Clicked node IMG descendant src attribute. * Whichever is found first. * * @param {*} node The node to find link text for. * @returns {string} link-name or an empty string if not link-name is found. */var getLinkName=function getLinkName(node){var nodeText=truncateWhiteSpace(node.innerText||node.textContent);var nodes=extractSupportedNodes(node);// if contains unsupported nodes we want children node attributes if(!nodeText||nodes.includesUnsupportedNodes){var attributesMap=getChildrenAttributes(nodes);nodeText=truncateWhiteSpace(attributesMap.texts.join(""));if(!nodeText){nodeText=attributesMap.alt||attributesMap.title||attributesMap.inputValue||attributesMap.imgSrc;}}return nodeText||"";};/* Copyright 2022 Adobe. All rights reserved. This file is licensed to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */var semanticElements=/^(HEADER|MAIN|FOOTER|NAV)$/i;var getAriaRegionLabel=function getAriaRegionLabel(node){var regionLabel;if(node.role==="region"&&isNonEmptyString(node["aria-label"])){regionLabel=node["aria-label"];}return regionLabel;};var getSectionNodeName=function getSectionNodeName(node){var nodeName;if(node&&node.nodeName){if(node.nodeName.match(semanticElements)){nodeName=node.nodeName;}}return nodeName;};/** * Extracts a node link-region. * * The link-region is determined by traversing up the DOM * looking for a region that is determined in order of priority: * * 1. element.id * 2. Aria region label * 3. Semantic element name * 4. BODY (if no other link-region is found). * * @param {*} node The node to find link region for. * @returns {string} link-region. */var getLinkRegion=function getLinkRegion(node){var linkParentNode=node.parentNode;var regionName;while(linkParentNode){regionName=truncateWhiteSpace(linkParentNode.id||getAriaRegionLabel(linkParentNode)||getSectionNodeName(linkParentNode));if(regionName){return regionName;}linkParentNode=linkParentNode.parentNode;}return"BODY";};/* Copyright 2024 Adobe. All rights reserved. This file is licensed to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */var urlStartsWithScheme=function urlStartsWithScheme(url){return!url?false:/^[a-z0-9]+:\/\//i.test(url);};/* Copyright 2024 Adobe. All rights reserved. This file is licensed to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */var getAbsoluteUrlFromAnchorElement=function getAbsoluteUrlFromAnchorElement(window,element){var loc=window.location;var href=element.href||"";// Some objects (like SVG animations) can contain a href object instead of a string if(typeof href!=="string"){href="";}var protocol=element.protocol,host=element.host;if(href&&!urlStartsWithScheme(href)){if(!protocol){protocol=loc.protocol?loc.protocol:"";}protocol=protocol?"".concat(protocol,"//"):"";if(!host){host=loc.host?loc.host:"";}var path="";if(href.substring(0,1)!=="/"){var indx=loc.pathname.lastIndexOf("/");indx=indx<0?0:indx;path=loc.pathname.substring(0,indx);}href="".concat(protocol).concat(host).concat(path,"/").concat(href);}return href;};/* Copyright 2024 Adobe. All rights reserved. This file is licensed to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */var isSupportedAnchorElement=function isSupportedAnchorElement(element){if(element.href&&(element.tagName==="A"||element.tagName==="AREA")&&(!element.onclick||!element.protocol||element.protocol.toLowerCase().indexOf("javascript")<0)){return true;}return false;};/* Copyright 2024 Adobe. All rights reserved. This file is licensed to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */var elementHasClickHandler=function elementHasClickHandler(element){return!element?false:!!element.onclick;};/* Copyright 2024 Adobe. All rights reserved. This file is licensed to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */var isInputSubmitElement=function isInputSubmitElement(element){if(element.tagName==="INPUT"){var type=element.getAttribute("type");if(type==="submit"){return true;}// Image type input elements are considered submit elements. // https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/image if(type==="image"&&element.src){return true;}}return false;};/* Copyright 2024 Adobe. All rights reserved. This file is licensed to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */var isButtonSubmitElement=function isButtonSubmitElement(element){return element.tagName==="BUTTON"&&element.type==="submit";};/* Copyright 2024 Adobe. All rights reserved. This file is licensed to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */var findClickableElement=function findClickableElement(element){var node=element;while(node){if(isSupportedAnchorElement(node)||elementHasClickHandler(node)||isInputSubmitElement(node)||isButtonSubmitElement(node)){return node;}node=node.parentNode;}return null;};/* Copyright 2024 Adobe. All rights reserved. This file is licensed to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */var trimQueryFromUrl=function trimQueryFromUrl(url){var questionMarkIndex=url.indexOf("?");var hashIndex=url.indexOf("#");if(questionMarkIndex>=0&&(questionMarkIndex=0){return url.substring(0,hashIndex);}return url;};/* Copyright 2024 Adobe. All rights reserved. This file is licensed to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */var isDownloadLink=function isDownloadLink(downloadLinkQualifier,linkUrl,clickedObj){var result=false;if(linkUrl){if(clickedObj&&clickedObj.download){result=true;}else if(downloadLinkQualifier){var re=new RegExp(downloadLinkQualifier);var trimmedLinkUrl=trimQueryFromUrl(linkUrl).toLowerCase();result=re.test(trimmedLinkUrl);}}return result;};/* Copyright 2024 Adobe. All rights reserved. This file is licensed to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */var isExitLink=function isExitLink(window,linkUrl){var result=false;// window.location.hostname should always be defined, but checking just in case if(linkUrl&&window.location.hostname){var currentHostname=window.location.hostname.toLowerCase();var trimmedLinkUrl=trimQueryFromUrl(linkUrl).toLowerCase();result=trimmedLinkUrl.indexOf(currentHostname)<0;}return result;};/* Copyright 2024 Adobe. All rights reserved. This file is licensed to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */var determineLinkType=function determineLinkType(window,config,linkUrl,clickedObj){var linkType="other";if(isNonEmptyString(linkUrl)){if(isDownloadLink(config.downloadLinkQualifier,linkUrl,clickedObj)){linkType="download";}else if(isExitLink(window,linkUrl)){linkType="exit";}}return linkType;};/* Copyright 2024 Adobe. All rights reserved. This file is licensed to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */var hasPageName=function hasPageName(event){var content=event.getContent();return content.xdm!==undefined&&// NOTE: A page view event should "ideally" include the pageViews type // && event.xdm.eventType === "web.webpagedetails.pageViews" content.xdm.web!==undefined&&content.xdm.web.webPageDetails!==undefined&&content.xdm.web.webPageDetails.name!==undefined;};/* Copyright 2024 Adobe. All rights reserved. This file is licensed to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */var createTransientStorage=function createTransientStorage(){var storage={};return{getItem:function getItem(key){return storage[key];},setItem:function setItem(key,value){storage[key]=value;},removeItem:function removeItem(key){delete storage[key];}};};/* Copyright 2019 Adobe. All rights reserved. This file is licensed to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */var getClickedElementProperties=createGetClickedElementProperties({window:window,getLinkName:getLinkName,getLinkRegion:getLinkRegion,getAbsoluteUrlFromAnchorElement:getAbsoluteUrlFromAnchorElement,findClickableElement:findClickableElement,determineLinkType:determineLinkType});var clickActivityStorage;var createActivityCollector=function createActivityCollector(_ref34){var config=_ref34.config,eventManager=_ref34.eventManager,handleError=_ref34.handleError,logger=_ref34.logger;var clickCollection=config.clickCollection;var createNamespacedStorage=injectStorage(window);var nameSpacedStorage=createNamespacedStorage(config.orgId||"");// Use transient in-memory if sessionStorage is disabled var transientStorage=createTransientStorage();var storage=clickCollection.sessionStorageEnabled?nameSpacedStorage.session:transientStorage;clickActivityStorage=createClickActivityStorage({storage:storage});var injectClickedElementProperties=createInjectClickedElementProperties({config:config,logger:logger,clickActivityStorage:clickActivityStorage,getClickedElementProperties:getClickedElementProperties});var recallAndInjectClickedElementProperties=createRecallAndInjectClickedElementProperties({clickActivityStorage:clickActivityStorage});var storePageViewProperties=createStorePageViewProperties({clickActivityStorage:clickActivityStorage});return{lifecycle:{onComponentsRegistered:function onComponentsRegistered(tools){var lifecycle=tools.lifecycle;attachClickActivityCollector({eventManager:eventManager,lifecycle:lifecycle,handleError:handleError});// TODO: createScrollActivityCollector ... },onClick:function onClick(_ref35){var event=_ref35.event,clickedElement=_ref35.clickedElement;injectClickedElementProperties({event:event,clickedElement:clickedElement});},onBeforeEvent:function onBeforeEvent(_ref36){var event=_ref36.event;if(hasPageName(event)){if(clickCollection.eventGroupingEnabled){recallAndInjectClickedElementProperties(event);}storePageViewProperties(event,logger,clickActivityStorage);}}}};};createActivityCollector.namespace="ActivityCollector";createActivityCollector.configValidators=configValidators$2;createActivityCollector.buildOnInstanceConfiguredExtraParams=function(_ref37){var config=_ref37.config,logger=_ref37.logger;return{getLinkDetails:function getLinkDetails(targetElement){return getClickedElementProperties({clickActivityStorage:clickActivityStorage,clickedElement:targetElement,config:config,logger:logger}).properties;}};};/* Copyright 2019 Adobe. All rights reserved. This file is licensed to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */var createResultLogMessage$1=function createResultLogMessage$1(idSync,success){return"ID sync ".concat(success?"succeeded":"failed",": ").concat(idSync.spec.url);};var injectProcessIdSyncs=function injectProcessIdSyncs(_ref38){var fireReferrerHideableImage=_ref38.fireReferrerHideableImage,logger=_ref38.logger;return function(idSyncs){var urlIdSyncs=idSyncs.filter(function(idSync){return idSync.type==="url";});if(!urlIdSyncs.length){return Promise.resolve();}return Promise.all(urlIdSyncs.map(function(idSync){return fireReferrerHideableImage(idSync.spec).then(function(){logger.info(createResultLogMessage$1(idSync,true));})["catch"](function(){// We intentionally do not throw an error if id syncs fail. We // consider it a non-critical failure and therefore do not want it to // reject the promise handed back to the customer. logger.error(createResultLogMessage$1(idSync,false));});})).then(noop);};};/* Copyright 2019 Adobe. All rights reserved. This file is licensed to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */var configValidators$1=boundObjectOf({thirdPartyCookiesEnabled:boundBoolean()["default"](true),idMigrationEnabled:boundBoolean()["default"](true)});/* Copyright 2020 Adobe. All rights reserved. This file is licensed to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ /** * Verifies user provided event options. * @param {*} options The user event options to validate * @returns {*} Validated options */var getIdentityOptionsValidator=boundObjectOf({namespaces:boundArrayOf(boundLiteral("ECID")).nonEmpty().uniqueItems()["default"](["ECID"]),edgeConfigOverrides:validateConfigOverride}).noUnknownFields()["default"]({namespaces:["ECID"]});/* Copyright 2022 Adobe. All rights reserved. This file is licensed to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ /** * Verifies user provided event options. * @param {*} options The user event options to validate * @returns {*} Validated options */var appendIdentityToUrlOptionsValidator=boundObjectOf({url:boundString().required().nonEmpty(),edgeConfigOverrides:validateConfigOverride}).required().noUnknownFields();/* Copyright 2023 Adobe. All rights reserved. This file is licensed to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */var createComponent$4=function createComponent$4(_ref39){var addEcidQueryToPayload=_ref39.addEcidQueryToPayload,addQueryStringIdentityToPayload=_ref39.addQueryStringIdentityToPayload,ensureSingleIdentity=_ref39.ensureSingleIdentity,setLegacyEcid=_ref39.setLegacyEcid,handleResponseForIdSyncs=_ref39.handleResponseForIdSyncs,getEcidFromResponse=_ref39.getEcidFromResponse,getIdentity=_ref39.getIdentity,consent=_ref39.consent,appendIdentityToUrl=_ref39.appendIdentityToUrl,logger=_ref39.logger;var ecid;var edge={};return{lifecycle:{onBeforeRequest:function onBeforeRequest(_ref40){var request=_ref40.request,onResponse=_ref40.onResponse,onRequestFailure=_ref40.onRequestFailure;// Querying the ECID on every request to be able to set the legacy cookie, and make it // available for the `getIdentity` command. addEcidQueryToPayload(request.getPayload());addQueryStringIdentityToPayload(request.getPayload());return ensureSingleIdentity({request:request,onResponse:onResponse,onRequestFailure:onRequestFailure});},onResponse:function onResponse(_ref41){var response=_ref41.response;if(!ecid){ecid=getEcidFromResponse(response);// Only data collection calls will have an ECID in the response. // https://jira.corp.adobe.com/browse/EXEG-1234 if(ecid){setLegacyEcid(ecid);}}// For sendBeacon requests, getEdge() will return {}, so we are using assign here // so that sendBeacon requests don't override the edge info from before. edge=(0,_reactorObjectAssign["default"])(edge,response.getEdge());return handleResponseForIdSyncs(response);}},commands:{getIdentity:{optionsValidator:getIdentityOptionsValidator,run:function run(options){return consent.awaitConsent().then(function(){return ecid?undefined:getIdentity(options);}).then(function(){return{identity:{ECID:ecid},edge:edge};});}},appendIdentityToUrl:{optionsValidator:appendIdentityToUrlOptionsValidator,run:function run(options){return consent.withConsent().then(function(){return ecid?undefined:getIdentity(options);}).then(function(){return{url:appendIdentityToUrl(ecid,options.url)};})["catch"](function(error){logger.warn("Unable to append identity to url. ".concat(error.message));return options;});}}}};};/* Copyright 2019 Adobe. All rights reserved. This file is licensed to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ /** * Handles migration of ECID to and from Visitor.js. */var createLegacyIdentity=function createLegacyIdentity(_ref42){var config=_ref42.config,getEcidFromVisitor=_ref42.getEcidFromVisitor,apexDomain=_ref42.apexDomain,isPageSsl=_ref42.isPageSsl,cookieJar=_ref42.cookieJar;var idMigrationEnabled=config.idMigrationEnabled,orgId=config.orgId;var amcvCookieName="AMCV_".concat(orgId);var getEcidFromLegacyCookies=function getEcidFromLegacyCookies(){var ecid=null;var secidCookieName="s_ecid";var legacyEcidCookieValue=cookieJar.get(secidCookieName)||cookieJar.get(amcvCookieName);if(legacyEcidCookieValue){var reg=/(^|\|)MCMID\|(\d+)($|\|)/;var _matches=legacyEcidCookieValue.match(reg);if(_matches){// Destructuring arrays breaks in IE ecid=_matches[2];}}return ecid;};return{getEcid:function getEcid(){if(idMigrationEnabled){var ecid=getEcidFromLegacyCookies();if(ecid){return Promise.resolve(ecid);}return getEcidFromVisitor();}return Promise.resolve();},setEcid:function setEcid(ecid){if(idMigrationEnabled&&getEcidFromLegacyCookies()!==ecid){var extraOptions=isPageSsl?{sameSite:"none",secure:true}:{};cookieJar.set(amcvCookieName,"MCMID|".concat(ecid),_objectSpread({domain:apexDomain,// Without `expires` this will be a session cookie. expires:390},extraOptions));}}};};/* Copyright 2020 Adobe. All rights reserved. This file is licensed to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */var awaitVisitorOptIn=function awaitVisitorOptIn(_ref43){var logger=_ref43.logger;return new Promise(function(resolve,reject){if(isObject(window.adobe)&&isObject(window.adobe.optIn)){var optInOld=window.adobe.optIn;logger.info("Delaying request while waiting for legacy opt-in to let Visitor retrieve ECID from server.");optInOld.fetchPermissions(function(){if(optInOld.isApproved([optInOld.Categories.ECID])){logger.info("Received legacy opt-in approval to let Visitor retrieve ECID from server.");resolve();}else{reject(new Error("Legacy opt-in was declined."));}},true);}else{resolve();}});};/* Copyright 2020 Adobe. All rights reserved. This file is licensed to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */var getVisitor=function getVisitor(window){var Visitor=window.Visitor;return isFunction(Visitor)&&isFunction(Visitor.getInstance)&&Visitor;};/* Copyright 2020 Adobe. All rights reserved. This file is licensed to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */var injectGetEcidFromVisitor=function injectGetEcidFromVisitor(_ref44){var logger=_ref44.logger,orgId=_ref44.orgId,awaitVisitorOptIn=_ref44.awaitVisitorOptIn;return function(){var Visitor=getVisitor(window);if(Visitor){// Need to explicitly wait for optIn because visitor will call callback // with invalid values prior to optIn being approved return awaitVisitorOptIn({logger:logger}).then(function(){logger.info("Delaying request while using Visitor to retrieve ECID from server.");return new Promise(function(resolve){var visitor=Visitor.getInstance(orgId,{});visitor.getMarketingCloudVisitorID(function(ecid){logger.info("Resuming previously delayed request that was waiting for ECID from Visitor.");resolve(ecid);},true);});})["catch"](function(error){// If consent was denied, get the ECID from experience edge. OptIn and AEP Web SDK // consent should operate independently, but during id migration AEP Web SDK needs // to wait for optIn object consent resolution so that only one ECID is generated. if(error){logger.info("".concat(error.message,", retrieving ECID from experience edge"));}else{logger.info("An error occurred while obtaining the ECID from Visitor.");}});}return Promise.resolve();};};/* Copyright 2020 Adobe. All rights reserved. This file is licensed to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */var injectHandleResponseForIdSyncs=function injectHandleResponseForIdSyncs(_ref45){var processIdSyncs=_ref45.processIdSyncs;return function(response){return processIdSyncs(response.getPayloadsByType("identity:exchange"));};};/* Copyright 2020 Adobe. All rights reserved. This file is licensed to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ // TO-DOCUMENT: We queue subsequent requests until we have an identity cookie. var injectEnsureSingleIdentity=function injectEnsureSingleIdentity(_ref46){var doesIdentityCookieExist=_ref46.doesIdentityCookieExist,setDomainForInitialIdentityPayload=_ref46.setDomainForInitialIdentityPayload,addLegacyEcidToPayload=_ref46.addLegacyEcidToPayload,awaitIdentityCookie=_ref46.awaitIdentityCookie,logger=_ref46.logger;var obtainedIdentityPromise;var allowRequestToGoWithoutIdentity=function allowRequestToGoWithoutIdentity(request){setDomainForInitialIdentityPayload(request);return addLegacyEcidToPayload(request.getPayload());};/** * Ensures that if no identity cookie exists, we only let one request at a * time without an identity until its response returns. In the meantime, * we queue all other requests, otherwise the requests could result in * multiple ECIDs being minted for the user. Once we get an identity * cookie, we can let the queued requests be sent all at once, since they * will have the newly minted ECID. * * Konductor should make every effort to return an identity, but in * certain scenarios it may not. For example, in cases where the * request does not match what Konductor is expecting (ie 400s). * In cases where Konductor does not set an identity, there should be * no events recorded so we don't need to worry about multiple ECIDs * being minted for each user. * * The reason we allow for multiple sequential requests to be sent without * an identity is to prevent a single malformed request causing all other * requests to never send. */return function(_ref47){var request=_ref47.request,onResponse=_ref47.onResponse,onRequestFailure=_ref47.onRequestFailure;if(doesIdentityCookieExist()){request.setIsIdentityEstablished();return Promise.resolve();}if(obtainedIdentityPromise){// We don't have an identity cookie, but at least one request has // been sent to get it. Konductor may set the identity cookie in the // response. We will hold up this request until the previous request // returns and awaitIdentityCookie confirms the identity was set. logger.info("Delaying request while retrieving ECID from server.");var previousObtainedIdentityPromise=obtainedIdentityPromise;// This promise resolves when we have an identity cookie. Additional // requests are chained together so that only one is sent at a time // until we have the identity cookie. obtainedIdentityPromise=previousObtainedIdentityPromise["catch"](function(){return awaitIdentityCookie({onResponse:onResponse,onRequestFailure:onRequestFailure});});// When this returned promise resolves, the request will go out. return previousObtainedIdentityPromise.then(function(){logger.info("Resuming previously delayed request.");request.setIsIdentityEstablished();})// If Konductor did not set the identity cookie on the previous // request, then awaitIdentityCookie will reject its promise. // Catch the rejection here and allow this request to go out. ["catch"](function(){return allowRequestToGoWithoutIdentity(request);});}// For Alloy+Konductor communication to be as robust as possible and // to ensure we don't mint new ECIDs for requests that would otherwise // be sent in parallel, we'll let this request go out to fetch the // cookie obtainedIdentityPromise=awaitIdentityCookie({onResponse:onResponse,onRequestFailure:onRequestFailure});// This prevents an un-caught promise in the console when the identity isn't set. obtainedIdentityPromise["catch"](function(){return undefined;});return allowRequestToGoWithoutIdentity(request);};};/* Copyright 2019 Adobe. All rights reserved. This file is licensed to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */var ecidNamespace="ECID";/* Copyright 2020 Adobe. All rights reserved. This file is licensed to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */var addEcidQueryToPayload=function addEcidQueryToPayload(payload){payload.mergeQuery({identity:{fetch:[ecidNamespace]}});};/* Copyright 2019 Adobe. All rights reserved. This file is licensed to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */var matchUserAgent=function matchUserAgent(regexs){return function(userAgent){var keys=Object.keys(regexs);for(var _i7=0;_i70&&arguments[0]!==undefined?arguments[0]:{},namespaces=_ref60.namespaces,localConfigOverrides=_ref60.edgeConfigOverrides;var requestParams=createRequestParams({payload:createIdentityRequestPayload(namespaces),globalConfigOverrides:globalConfigOverrides,localConfigOverrides:localConfigOverrides});var request=createIdentityRequest(requestParams);return sendEdgeNetworkRequest({request:request});};};/* Copyright 2020 Adobe. All rights reserved. This file is licensed to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */var createIdentityRequest=function createIdentityRequest(_ref61){var payload=_ref61.payload,datastreamIdOverride=_ref61.datastreamIdOverride;return createRequest({payload:payload,datastreamIdOverride:datastreamIdOverride,getAction:function getAction(){return"identity/acquire";},getUseSendBeacon:function getUseSendBeacon(){return false;}});};/* Copyright 2020 Adobe. All rights reserved. This file is licensed to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */var createIdentityRequestPayload=function createIdentityRequestPayload(namespaces){var content={query:{identity:{fetch:namespaces}}};return createRequestPayload({content:content,addIdentity:createAddIdentity(content),hasIdentity:createHasIdentity(content)});};/* Copyright 2022 Adobe. All rights reserved. This file is licensed to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */var URL_REGEX=/^([^?#]*)(\??[^#]*)(#?.*)$/;var getSeparator=function getSeparator(queryString){if(queryString===""){return"?";}if(queryString==="?"){return"";}return"&";};var injectAppendIdentityToUrl=function injectAppendIdentityToUrl(_ref62){var dateProvider=_ref62.dateProvider,orgId=_ref62.orgId;return function(ecid,url){var ts=Math.round(dateProvider().getTime()/1000);var adobemc=encodeURIComponent("TS=".concat(ts,"|MCMID=").concat(ecid,"|MCORGID=").concat(encodeURIComponent(orgId)));var _url$match=url.match(URL_REGEX),_url$match2=_slicedToArray(_url$match,4),location=_url$match2[1],queryString=_url$match2[2],fragment=_url$match2[3];var separator=getSeparator(queryString);return"".concat(location).concat(queryString).concat(separator,"adobe_mc=").concat(adobemc).concat(fragment);};};/* Copyright 2019 Adobe. All rights reserved. This file is licensed to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */var createIdentity=function createIdentity(_ref63){var config=_ref63.config,logger=_ref63.logger,consent=_ref63.consent,fireReferrerHideableImage=_ref63.fireReferrerHideableImage,sendEdgeNetworkRequest=_ref63.sendEdgeNetworkRequest,apexDomain=_ref63.apexDomain;var orgId=config.orgId,thirdPartyCookiesEnabled=config.thirdPartyCookiesEnabled,globalConfigOverrides=config.edgeConfigOverrides;var getEcidFromVisitor=injectGetEcidFromVisitor({logger:logger,orgId:orgId,awaitVisitorOptIn:awaitVisitorOptIn});var loggingCookieJar=createLoggingCookieJar({logger:logger,cookieJar:cookieJar});var legacyIdentity=createLegacyIdentity({config:config,getEcidFromVisitor:getEcidFromVisitor,apexDomain:apexDomain,cookieJar:loggingCookieJar,isPageSsl:window.location.protocol==="https:"});var doesIdentityCookieExist=injectDoesIdentityCookieExist({orgId:orgId});var getIdentity=createGetIdentity({sendEdgeNetworkRequest:sendEdgeNetworkRequest,createIdentityRequestPayload:createIdentityRequestPayload,createIdentityRequest:createIdentityRequest,globalConfigOverrides:globalConfigOverrides});var setDomainForInitialIdentityPayload=injectSetDomainForInitialIdentityPayload({thirdPartyCookiesEnabled:thirdPartyCookiesEnabled,areThirdPartyCookiesSupportedByDefault:areThirdPartyCookiesSupportedByDefault});var addLegacyEcidToPayload=injectAddLegacyEcidToPayload({getLegacyEcid:legacyIdentity.getEcid,addEcidToPayload:addEcidToPayload});var addQueryStringIdentityToPayload=injectAddQueryStringIdentityToPayload({locationSearch:window.document.location.search,dateProvider:function dateProvider(){return new Date();},orgId:orgId,logger:logger});var awaitIdentityCookie=injectAwaitIdentityCookie({doesIdentityCookieExist:doesIdentityCookieExist,orgId:orgId,logger:logger});var ensureSingleIdentity=injectEnsureSingleIdentity({doesIdentityCookieExist:doesIdentityCookieExist,setDomainForInitialIdentityPayload:setDomainForInitialIdentityPayload,addLegacyEcidToPayload:addLegacyEcidToPayload,awaitIdentityCookie:awaitIdentityCookie,logger:logger});var processIdSyncs=injectProcessIdSyncs({fireReferrerHideableImage:fireReferrerHideableImage,logger:logger});var handleResponseForIdSyncs=injectHandleResponseForIdSyncs({processIdSyncs:processIdSyncs});var appendIdentityToUrl=injectAppendIdentityToUrl({dateProvider:function dateProvider(){return new Date();},orgId:orgId,globalConfigOverrides:globalConfigOverrides});return createComponent$4({addEcidQueryToPayload:addEcidQueryToPayload,addQueryStringIdentityToPayload:addQueryStringIdentityToPayload,ensureSingleIdentity:ensureSingleIdentity,setLegacyEcid:legacyIdentity.setEcid,handleResponseForIdSyncs:handleResponseForIdSyncs,getEcidFromResponse:getEcidFromResponse,getIdentity:getIdentity,consent:consent,appendIdentityToUrl:appendIdentityToUrl,logger:logger,config:config});};createIdentity.namespace="Identity";createIdentity.configValidators=configValidators$1;/* Copyright 2019 Adobe. All rights reserved. This file is licensed to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */var createResultLogMessage=function createResultLogMessage(urlDestination,success){return"URL destination ".concat("succeeded",": ",urlDestination.spec.url);};var injectProcessDestinations=function injectProcessDestinations(_ref64){var fireReferrerHideableImage=_ref64.fireReferrerHideableImage,logger=_ref64.logger,cookieJar=_ref64.cookieJar,isPageSsl=_ref64.isPageSsl;var extraCookieOptions=isPageSsl?{sameSite:"none",secure:true}:{};var processCookies=function processCookies(destinations){var cookieDestinations=destinations.filter(function(dest){return dest.type==="cookie";});cookieDestinations.forEach(function(dest){var _dest$spec=dest.spec,name=_dest$spec.name,value=_dest$spec.value,domain=_dest$spec.domain,ttlDays=_dest$spec.ttlDays;cookieJar.set(name,value||"",_objectSpread({domain:domain||"",expires:ttlDays||10},extraCookieOptions));});};var processUrls=function processUrls(destinations){var urlDestinations=destinations.filter(function(dest){return dest.type==="url";});return Promise.all(urlDestinations.map(function(urlDestination){return fireReferrerHideableImage(urlDestination.spec).then(function(){logger.info(createResultLogMessage(urlDestination));})["catch"](function(){// We intentionally do not throw an error if destinations fail. We // consider it a non-critical failure and therefore do not want it to // reject the promise handed back to the customer. });})).then(noop);};return function(destinations){processCookies(destinations);return processUrls(destinations);};};/* Copyright 2021 Adobe. All rights reserved. This file is licensed to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */var injectProcessResponse=function injectProcessResponse(_ref65){var processDestinations=_ref65.processDestinations;var processPushDestinations=function processPushDestinations(_ref66){var response=_ref66.response;var destinations=response.getPayloadsByType("activation:push");return processDestinations(destinations);};var retrievePullDestinations=function retrievePullDestinations(_ref67){var response=_ref67.response;return{destinations:response.getPayloadsByType("activation:pull")};};return function(_ref68){var response=_ref68.response;return processPushDestinations({response:response}).then(function(){return retrievePullDestinations({response:response});});};};/* Copyright 2019 Adobe. All rights reserved. This file is licensed to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */var createAudiences=function createAudiences(_ref69){var logger=_ref69.logger,fireReferrerHideableImage=_ref69.fireReferrerHideableImage;// we override the js-cookie converter to encode the cookie value similar on how it is in DIL (PDCL-10238) var cookieJarWithEncoding=cookieJar.withConverter({write:function write(value){return encodeURIComponent(value);}});var loggingCookieJar=createLoggingCookieJar({logger:logger,cookieJar:cookieJarWithEncoding});var processDestinations=injectProcessDestinations({fireReferrerHideableImage:fireReferrerHideableImage,logger:logger,cookieJar:loggingCookieJar,isPageSsl:window.location.protocol==="https:"});var processResponse=injectProcessResponse({processDestinations:processDestinations});return{lifecycle:{onResponse:processResponse},commands:{}};};createAudiences.namespace="Audiences";/* Copyright 2022 Adobe. All rights reserved. This file is licensed to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */var WEB="web";var WEBAPP="webapp";var SURFACE_TYPE_DELIMITER="://";var FRAGMENT_DELIMITER="#";/* Copyright 2022 Adobe. All rights reserved. This file is licensed to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */var SURFACE_REGEX=/^(\w+):\/\/([^/#]+)(\/[^#]*)?(#.*)?$/;var AUTHORITY_REGEX=/^(?:.*@)?(?:[a-z\d\u00a1-\uffff.-]+|\[[a-f\d:]+])(?::\d+)?$/;var PATH_REGEX=/^\/(?:[/\w\u00a1-\uffff-.~]|%[a-fA-F\d]{2})*$/;var FRAGMENT_REGEX=/^#(?:[/\w\u00a1-\uffff-.~]|%[a-fA-F\d]{2})+$/;var normalizePath=function normalizePath(){var path=arguments.length>0&&arguments[0]!==undefined?arguments[0]:"/";var end=path.length;while(end>0&&"/".indexOf(path.charAt(end-1))!==-1){end-=1;}return path.substring(0,end)||"/";};var getSurfaceType=function getSurfaceType(surfaceTypeMatch){return isNonEmptyString(surfaceTypeMatch)?surfaceTypeMatch.toLowerCase():"";};var getAuthority=function getAuthority(authorityMatch){return isNonEmptyString(authorityMatch)?authorityMatch.toLowerCase():"";};var getPath=function getPath(pathMatch){return isNonEmptyString(pathMatch)?normalizePath(pathMatch):"/";};var parseSurface=function parseSurface(surfaceString){var matched=surfaceString.match(SURFACE_REGEX);return matched?{surfaceType:getSurfaceType(matched[1]),authority:getAuthority(matched[2]),path:getPath(matched[3]),fragment:matched[4]}:null;};var stringifySurface=function stringifySurface(surface){return"".concat(surface.surfaceType).concat(SURFACE_TYPE_DELIMITER).concat(surface.authority).concat(surface.path||"").concat(surface.fragment||"");};var buildPageSurface=function buildPageSurface(getPageLocation){var location=getPageLocation();var host=location.host.toLowerCase();var path=location.pathname;return WEB+SURFACE_TYPE_DELIMITER+host+normalizePath(path);};var expandFragmentSurface=function expandFragmentSurface(surface,getPageLocation){return startsWith(surface,FRAGMENT_DELIMITER)?buildPageSurface(getPageLocation)+surface:surface;};var validateSurface=function validateSurface(surface,getPageLocation,logger){var invalidateSurface=function invalidateSurface(validationError){logger.warn(validationError);return null;};if(!isNonEmptyString(surface)){return invalidateSurface("Invalid surface: ".concat(surface));}var expanded=expandFragmentSurface(surface,getPageLocation);var parsed=parseSurface(expanded);if(parsed===null){return invalidateSurface("Invalid surface: ".concat(surface));}if(!includes([WEB,WEBAPP],parsed.surfaceType)){return invalidateSurface("Unsupported surface type ".concat(parsed.surfaceType," in surface: ").concat(surface));}if(!parsed.authority||!AUTHORITY_REGEX.test(parsed.authority)){return invalidateSurface("Invalid authority ".concat(parsed.authority," in surface: ").concat(surface));}if(parsed.path&&!PATH_REGEX.test(parsed.path)){return invalidateSurface("Invalid path ".concat(parsed.path," in surface: ").concat(surface));}if(parsed.fragment&&!FRAGMENT_REGEX.test(parsed.fragment)){return invalidateSurface("Invalid fragment ".concat(parsed.fragment," in surface: ").concat(surface));}return parsed;};var isPageWideSurface=function isPageWideSurface(scope){return!!scope&&scope.indexOf(WEB+SURFACE_TYPE_DELIMITER)===0&&scope.indexOf(FRAGMENT_DELIMITER)===-1;};// eslint-disable-next-line default-param-last var normalizeSurfaces=function normalizeSurfaces(){var surfaces=arguments.length>0&&arguments[0]!==undefined?arguments[0]:[];var getPageLocation=arguments.length>1?arguments[1]:undefined;var logger=arguments.length>2?arguments[2]:undefined;return surfaces.map(function(surface){return validateSurface(surface,getPageLocation,logger);}).filter(function(surface){return!isNil(surface);}).map(stringifySurface);};/* Copyright 2019 Adobe. All rights reserved. This file is licensed to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */var PAGE_WIDE_SCOPE="__view__";/* Copyright 2019 Adobe. All rights reserved. This file is licensed to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */var DEFAULT_CONTENT_ITEM="https://ns.adobe.com/personalization/default-content-item";var DOM_ACTION="https://ns.adobe.com/personalization/dom-action";var HTML_CONTENT_ITEM="https://ns.adobe.com/personalization/html-content-item";var JSON_CONTENT_ITEM="https://ns.adobe.com/personalization/json-content-item";var RULESET_ITEM="https://ns.adobe.com/personalization/ruleset-item";var REDIRECT_ITEM="https://ns.adobe.com/personalization/redirect-item";var MESSAGE_IN_APP="https://ns.adobe.com/personalization/message/in-app";var MESSAGE_FEED_ITEM="https://ns.adobe.com/personalization/message/feed-item";/* Copyright 2020 Adobe. All rights reserved. This file is licensed to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */var addPageWideScope=function addPageWideScope(scopes){if(!includes(scopes,PAGE_WIDE_SCOPE)){scopes.push(PAGE_WIDE_SCOPE);}};var addPageSurface=function addPageSurface(surfaces,getPageLocation){var pageSurface=buildPageSurface(getPageLocation);if(!includes(surfaces,pageSurface)){surfaces.push(pageSurface);}};var dedupe=function dedupe(array){return array.filter(function(item,pos){return array.indexOf(item)===pos;});};var createPersonalizationDetails=function createPersonalizationDetails(_ref70){var getPageLocation=_ref70.getPageLocation,renderDecisions=_ref70.renderDecisions,decisionScopes=_ref70.decisionScopes,personalization=_ref70.personalization,event=_ref70.event,_isCacheInitialized=_ref70.isCacheInitialized,logger=_ref70.logger;var viewName=event.getViewName();return{isRenderDecisions:function isRenderDecisions(){return renderDecisions;},isSendDisplayEvent:function isSendDisplayEvent(){return!!personalization.sendDisplayEvent;},shouldIncludeRenderedPropositions:function shouldIncludeRenderedPropositions(){return!!personalization.includeRenderedPropositions;},getViewName:function getViewName(){return viewName;},hasScopes:function hasScopes(){return decisionScopes.length>0||isNonEmptyArray(personalization.decisionScopes);},hasSurfaces:function hasSurfaces(){return isNonEmptyArray(personalization.surfaces);},hasViewName:function hasViewName(){return isNonEmptyString(viewName);},createQueryDetails:function createQueryDetails(){var scopes=_toConsumableArray(decisionScopes);if(isNonEmptyArray(personalization.decisionScopes)){scopes.push.apply(scopes,_toConsumableArray(personalization.decisionScopes));}var eventSurfaces=normalizeSurfaces(personalization.surfaces,getPageLocation,logger);if(this.shouldRequestDefaultPersonalization()){addPageWideScope(scopes);addPageSurface(eventSurfaces,getPageLocation);}var schemas=[DEFAULT_CONTENT_ITEM,HTML_CONTENT_ITEM,JSON_CONTENT_ITEM,REDIRECT_ITEM,RULESET_ITEM,MESSAGE_IN_APP,MESSAGE_FEED_ITEM];if(includes(scopes,PAGE_WIDE_SCOPE)){schemas.push(DOM_ACTION);}return{schemas:schemas,decisionScopes:dedupe(scopes),surfaces:dedupe(eventSurfaces)};},isCacheInitialized:function isCacheInitialized(){return _isCacheInitialized;},shouldFetchData:function shouldFetchData(){return this.hasScopes()||this.hasSurfaces()||this.shouldRequestDefaultPersonalization();},shouldUseCachedData:function shouldUseCachedData(){return this.hasViewName()&&!this.shouldFetchData();},shouldRequestDefaultPersonalization:function shouldRequestDefaultPersonalization(){return personalization.defaultPersonalizationEnabled||!this.isCacheInitialized()&&personalization.defaultPersonalizationEnabled!==false;}};};/* Copyright 2023 Adobe. All rights reserved. This file is licensed to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */var AUTHORING_ENABLED="Rendering is disabled for authoring mode.";/* Copyright 2022 Adobe. All rights reserved. This file is licensed to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */var DISPLAY="decisioning.propositionDisplay";var INTERACT="decisioning.propositionInteract";var TRIGGER="decisioning.propositionTrigger";var DISMISS="decisioning.propositionDismiss";var EVENT_TYPE_TRUE=1;/* Copyright 2022 Adobe. All rights reserved. This file is licensed to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */var PropositionEventType={DISPLAY:"display",INTERACT:"interact",TRIGGER:"trigger",DISMISS:"dismiss"};var eventTypeToPropositionEventTypeMapping=_defineProperty(_defineProperty(_defineProperty(_defineProperty({},DISPLAY,PropositionEventType.DISPLAY),INTERACT,PropositionEventType.INTERACT),TRIGGER,PropositionEventType.TRIGGER),DISMISS,PropositionEventType.DISMISS);var getPropositionEventType=function getPropositionEventType(eventType){return eventTypeToPropositionEventTypeMapping[eventType];};/* Copyright 2023 Adobe. All rights reserved. This file is licensed to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */var EMPTY_PROPOSITIONS={propositions:[]};var validateApplyPropositionsOptions=function validateApplyPropositionsOptions(_ref71){var logger=_ref71.logger,options=_ref71.options;var applyPropositionsOptionsValidator=boundObjectOf({propositions:boundArrayOf(boundObjectOf({id:boundString().required(),scope:boundString().required(),scopeDetails:boundObjectOf({decisionProvider:boundString().required()}).required(),items:boundArrayOf(boundObjectOf({id:boundString().required(),schema:boundString().required(),data:boundAnything().required()})).nonEmpty().required()}).required()).nonEmpty().required(),metadata:boundObjectOf(boundAnything()),viewName:boundString()}).required();try{return applyPropositionsOptionsValidator(options);}catch(e){logger.warn("Invalid options for applyPropositions. No propositions will be applied.",e);return EMPTY_PROPOSITIONS;}};/* Copyright 2020 Adobe. All rights reserved. This file is licensed to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */var createComponent$3=function createComponent$3(_ref72){var getPageLocation=_ref72.getPageLocation,logger=_ref72.logger,fetchDataHandler=_ref72.fetchDataHandler,viewChangeHandler=_ref72.viewChangeHandler,onClickHandler=_ref72.onClickHandler,isAuthoringModeEnabled=_ref72.isAuthoringModeEnabled,mergeQuery=_ref72.mergeQuery,viewCache=_ref72.viewCache,showContainers=_ref72.showContainers,applyPropositions=_ref72.applyPropositions,setTargetMigration=_ref72.setTargetMigration,mergeDecisionsMeta=_ref72.mergeDecisionsMeta,renderedPropositions=_ref72.renderedPropositions,onDecisionHandler=_ref72.onDecisionHandler,handleConsentFlicker=_ref72.handleConsentFlicker;return{lifecycle:{onComponentsRegistered:function onComponentsRegistered(){handleConsentFlicker();},onDecision:onDecisionHandler,onBeforeRequest:function onBeforeRequest(_ref73){var request=_ref73.request;setTargetMigration(request);return Promise.resolve();},onBeforeEvent:function onBeforeEvent(_ref74){var event=_ref74.event,renderDecisions=_ref74.renderDecisions,_ref74$decisionScopes=_ref74.decisionScopes,decisionScopes=_ref74$decisionScopes===void 0?[]:_ref74$decisionScopes,_ref74$personalizatio=_ref74.personalization,personalization=_ref74$personalizatio===void 0?{}:_ref74$personalizatio,_ref74$onResponse=_ref74.onResponse,onResponse=_ref74$onResponse===void 0?noop:_ref74$onResponse,_ref74$onRequestFailu=_ref74.onRequestFailure,onRequestFailure=_ref74$onRequestFailu===void 0?noop:_ref74$onRequestFailu;// Include propositions on all responses, overridden with data as needed onResponse(function(){return{propositions:[]};});onRequestFailure(function(){return showContainers();});if(isAuthoringModeEnabled()){logger.warn(AUTHORING_ENABLED);// If we are in authoring mode we disable personalization mergeQuery(event,{enabled:false});return Promise.resolve();}var personalizationDetails=createPersonalizationDetails({getPageLocation:getPageLocation,renderDecisions:renderDecisions,decisionScopes:decisionScopes,personalization:personalization,event:event,isCacheInitialized:viewCache.isInitialized(),logger:logger});var decisionsMetaPromises=[];if(personalizationDetails.shouldIncludeRenderedPropositions()){decisionsMetaPromises.push(renderedPropositions.clear());}if(personalizationDetails.shouldFetchData()){var cacheUpdate=viewCache.createCacheUpdate(personalizationDetails.getViewName());onRequestFailure(function(){return cacheUpdate.cancel();});fetchDataHandler({cacheUpdate:cacheUpdate,personalizationDetails:personalizationDetails,event:event,onResponse:onResponse});}else if(personalizationDetails.shouldUseCachedData()){// eslint-disable-next-line consistent-return decisionsMetaPromises.push(viewChangeHandler({personalizationDetails:personalizationDetails,event:event,onResponse:onResponse,onRequestFailure:onRequestFailure}));}// This promise.all waits for both the pending display notifications to be resolved // (i.e. the top of page call to finish rendering) and the view change handler to // finish rendering anything for this view. return Promise.all(decisionsMetaPromises).then(function(decisionsMetas){// We only want to call mergeDecisionsMeta once, but we can get the propositions // from two places: the pending display notifications and the view change handler. var decisionsMeta=flatMap(decisionsMetas,function(dms){return dms;});if(isNonEmptyArray(decisionsMeta)){mergeDecisionsMeta(event,decisionsMeta,[PropositionEventType.DISPLAY]);}});},onClick:function onClick(_ref75){var event=_ref75.event,clickedElement=_ref75.clickedElement;onClickHandler({event:event,clickedElement:clickedElement});}},commands:{applyPropositions:{optionsValidator:function optionsValidator(options){return validateApplyPropositionsOptions({logger:logger,options:options});},run:applyPropositions}}};};/* Copyright 2019 Adobe. All rights reserved. This file is licensed to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */var createFragment=function createFragment(content){return createNode(DIV,{},{innerHTML:content});};var css_escape={exports:{}};/*! https://mths.be/cssescape v1.5.1 by @mathias | MIT license */(function(module,exports){(function(root,factory){// https://github.com/umdjs/umd/blob/master/returnExports.js {// For Node.js. module.exports=factory(root);}})(typeof commonjsGlobal!='undefined'?commonjsGlobal:commonjsGlobal,function(root){if(root.CSS&&root.CSS.escape){return root.CSS.escape;}// https://drafts.csswg.org/cssom/#serialize-an-identifier var cssEscape=function cssEscape(value){if(arguments.length==0){throw new TypeError('`CSS.escape` requires an argument.');}var string=String(value);var length=string.length;var index=-1;var codeUnit;var result='';var firstCodeUnit=string.charCodeAt(0);while(++index=0x0001&&codeUnit<=0x001F||codeUnit==0x007F||// If the character is the first character and is in the range [0-9] // (U+0030 to U+0039), […] index==0&&codeUnit>=0x0030&&codeUnit<=0x0039||// If the character is the second character and is in the range [0-9] // (U+0030 to U+0039) and the first character is a `-` (U+002D), […] index==1&&codeUnit>=0x0030&&codeUnit<=0x0039&&firstCodeUnit==0x002D){// https://drafts.csswg.org/cssom/#escape-a-character-as-code-point result+='\\'+codeUnit.toString(16)+' ';continue;}if(// If the character is the first character and is a `-` (U+002D), and // there is no second character, […] index==0&&length==1&&codeUnit==0x002D){result+='\\'+string.charAt(index);continue;}// If the character is not handled by one of the above rules and is // greater than or equal to U+0080, is `-` (U+002D) or `_` (U+005F), or // is in one of the ranges [0-9] (U+0030 to U+0039), [A-Z] (U+0041 to // U+005A), or [a-z] (U+0061 to U+007A), […] if(codeUnit>=0x0080||codeUnit==0x002D||codeUnit==0x005F||codeUnit>=0x0030&&codeUnit<=0x0039||codeUnit>=0x0041&&codeUnit<=0x005A||codeUnit>=0x0061&&codeUnit<=0x007A){// the character itself result+=string.charAt(index);continue;}// Otherwise, the escaped character. // https://drafts.csswg.org/cssom/#escape-a-character result+='\\'+string.charAt(index);}return result;};if(!root.CSS){root.CSS={};}root.CSS.escape=cssEscape;return cssEscape;});})(css_escape);var css_escapeExports=css_escape.exports;var escape$1=/*@__PURE__*/getDefaultExportFromCjs(css_escapeExports);/* Copyright 2019 Adobe. All rights reserved. This file is licensed to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */var EQ_START=":eq(";var EQ_PATTERN=/:eq\((\d+)\)/g;var isNotEqSelector=function isNotEqSelector(str){return str.indexOf(EQ_START)===-1;};var splitWithEq=function splitWithEq(selector){return selector.split(EQ_PATTERN).filter(isNonEmptyString);};/* Copyright 2019 Adobe. All rights reserved. This file is licensed to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ // Trying to match ID or CSS class var CSS_IDENTIFIER_PATTERN=/(#|\.)(-?\w+)/g;// Here we use CSS.escape() to make sure we get // correct values for ID and CSS class // Please check: https://www.w3.org/TR/css-syntax-3/#escaping // CSS.escape() polyfill can be found here: https://github.com/mathiasbynens/CSS.escape var replaceIdentifier=function replaceIdentifier(_,$1,$2){return"".concat($1).concat(escape$1($2));};var escapeIdentifiersInSelector=function escapeIdentifiersInSelector(selector){return selector.replace(CSS_IDENTIFIER_PATTERN,replaceIdentifier);};var parseSelector=function parseSelector(rawSelector){var result=[];var selector=escapeIdentifiersInSelector(rawSelector.trim());var parts=splitWithEq(selector);var length=parts.length;var i=0;while(inodesCount-1){break;}if(i1&&arguments[1]!==undefined?arguments[1]:document;return context.getElementById(id);};/* Copyright 2019 Adobe. All rights reserved. This file is licensed to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */var setAttribute=function setAttribute(element,name,value){element.setAttribute(name,value);};/* Copyright 2019 Adobe. All rights reserved. This file is licensed to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */var getAttribute=function getAttribute(element,name){return element.getAttribute(name);};/* Copyright 2019 Adobe. All rights reserved. This file is licensed to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */var removeAttribute=function removeAttribute(element,name){element.removeAttribute(name);};/* Copyright 2019 Adobe. All rights reserved. This file is licensed to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */var setStyle=function setStyle(element,name,value,priority){var css;if(priority){css="".concat(name,":").concat(value," !").concat(priority,";");}else{css="".concat(name,":").concat(value,";");}element.style.cssText+=";".concat(css);};/* Copyright 2019 Adobe. All rights reserved. This file is licensed to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */var getParent=function getParent(element){return element.parentNode;};/* Copyright 2019 Adobe. All rights reserved. This file is licensed to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */var getNextSibling=function getNextSibling(element){return element.nextElementSibling;};/* Copyright 2019 Adobe. All rights reserved. This file is licensed to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */var insertAfter=function insertAfter(container,element){if(!container){return;}var parent=getParent(container);if(parent){parent.insertBefore(element,getNextSibling(container));}};/* Copyright 2019 Adobe. All rights reserved. This file is licensed to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */var insertBefore=function insertBefore(container,element){if(!container){return;}var parent=getParent(container);if(parent){parent.insertBefore(element,container);}};/* Copyright 2019 Adobe. All rights reserved. This file is licensed to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */var getChildren=function getChildren(element){var children=element.children;if(children){return toArray(children);}return[];};/* Copyright 2019 Adobe. All rights reserved. This file is licensed to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */var getChildNodes=function getChildNodes(element){var childNodes=element.childNodes;if(childNodes){return toArray(childNodes);}return[];};/* Copyright 2019 Adobe. All rights reserved. This file is licensed to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */var getFirstChild=function getFirstChild(element){return element.firstElementChild;};/* Copyright 2019 Adobe. All rights reserved. This file is licensed to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */var nonce;/** * Returns the nonce if available. * @param {Node} [context=document] defaults to document * @returns {(String|undefined)} the nonce or undefined if not available */var getNonce=function getNonce(){var context=arguments.length>0&&arguments[0]!==undefined?arguments[0]:document;if(nonce===undefined){var n=context.querySelector("[nonce]");// NOTE: We're keeping n.getAttribute("nonce") until it is safe to remove: // ref: https://github.com/whatwg/html/issues/2369#issuecomment-280853946 nonce=n&&(n.nonce||n.getAttribute("nonce"));}return nonce;};/* Copyright 2022 Adobe. All rights reserved. This file is licensed to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */var SRC="src";/* Copyright 2019 Adobe. All rights reserved. This file is licensed to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */var isImage=function isImage(element){return element.tagName===IMG;};var loadImage=function loadImage(url){return createNode(IMG,{src:url});};var loadImages=function loadImages(fragment){var images=selectNodes(IMG,fragment);images.forEach(function(image){var url=getAttribute(image,SRC);if(url){loadImage(url);}});};/* Copyright 2019 Adobe. All rights reserved. This file is licensed to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */var is$1=function is$1(element,tagName){return element.tagName===tagName;};var isInlineStyleElement=function isInlineStyleElement(element){return is$1(element,STYLE)&&!getAttribute(element,SRC);};var addNonceToInlineStyleElements=function addNonceToInlineStyleElements(fragment){var styleNodes=selectNodes(STYLE,fragment);var length=styleNodes.length;var nonce=getNonce();if(!nonce){return;}/* eslint-disable no-continue */for(var _i8=0;_i8=0){var element=elements[i];decorateProposition(element);var firstChild=getFirstChild(container);if(firstChild){insertBefore(firstChild,element);}else{appendNode(container,element);}i-=1;}executeInlineScripts(container,scripts);return executeRemoteScripts(scriptsUrls);};/* Copyright 2019 Adobe. All rights reserved. This file is licensed to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */var PREHIDING_ID="alloy-prehiding";var HIDING_STYLE_DEFINITION="{ visibility: hidden }";// Using global is OK since we have a single DOM // so storing nodes even for multiple Alloy instances is fine var styleNodes={};var hideElements=function hideElements(prehidingSelector){// if we have different events with the same // prehiding selector we don't want to recreate // the style tag if(styleNodes[prehidingSelector]){return;}var nonce=getNonce();var attrs=_objectSpread({},nonce&&{nonce:nonce});var props={textContent:"".concat(prehidingSelector," ").concat(HIDING_STYLE_DEFINITION)};var node=createNode(STYLE,attrs,props);appendNode(document.head,node);styleNodes[prehidingSelector]=node;};var showElements=function showElements(prehidingSelector){var node=styleNodes[prehidingSelector];if(node){removeNode(node);delete styleNodes[prehidingSelector];}};var hideContainers=function hideContainers(prehidingStyle){if(!prehidingStyle){return;}// If containers prehiding style has been added // by customer's prehiding snippet we don't // want to add the same node var node=getElementById(PREHIDING_ID);if(node){return;}var nonce=getNonce();var attrs=_objectSpread({id:PREHIDING_ID},nonce&&{nonce:nonce});var props={textContent:prehidingStyle};var styleNode=createNode(STYLE,attrs,props);appendNode(document.head,styleNode);};var showContainers=function showContainers(){// If containers prehiding style exists // we will remove it var node=getElementById(PREHIDING_ID);if(!node){return;}removeNode(node);};/* Copyright 2019 Adobe. All rights reserved. This file is licensed to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */var setText=function setText(container,text,decorateProposition){decorateProposition(container);container.textContent=text;};/* Copyright 2019 Adobe. All rights reserved. This file is licensed to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */var insertHtmlBefore=function insertHtmlBefore(container,html,decorateProposition){var fragment=createFragment(html);addNonceToInlineStyleElements(fragment);var elements=getChildNodes(fragment);var scripts=getInlineScripts(fragment);var scriptsUrls=getRemoteScriptsUrls(fragment);loadImages(fragment);elements.forEach(function(element){decorateProposition(element);insertBefore(container,element);});executeInlineScripts(container,scripts);return executeRemoteScripts(scriptsUrls);};/* Copyright 2019 Adobe. All rights reserved. This file is licensed to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */var replaceHtml=function replaceHtml(container,html,decorateProposition){return insertHtmlBefore(container,html,decorateProposition).then(function(){removeNode(container);});};/* Copyright 2019 Adobe. All rights reserved. This file is licensed to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */var insertHtmlAfter=function insertHtmlAfter(container,html,decorateProposition){var fragment=createFragment(html);addNonceToInlineStyleElements(fragment);var elements=getChildNodes(fragment);var scripts=getInlineScripts(fragment);var scriptsUrls=getRemoteScriptsUrls(fragment);loadImages(fragment);var insertionPoint=container;elements.forEach(function(element){decorateProposition(element);insertAfter(insertionPoint,element);insertionPoint=element;});executeInlineScripts(container,scripts);return executeRemoteScripts(scriptsUrls);};/* Copyright 2019 Adobe. All rights reserved. This file is licensed to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */var setStyles=function setStyles(container,styles,decorateProposition){var priority=styles.priority,style=_objectWithoutProperties(styles,_excluded3);Object.keys(style).forEach(function(key){setStyle(container,key,style[key],priority);});decorateProposition(container);};/* Copyright 2019 Adobe. All rights reserved. This file is licensed to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */var setAttributes=function setAttributes(container,attributes,decorateProposition){Object.keys(attributes).forEach(function(key){setAttribute(container,key,attributes[key]);});decorateProposition(container);};/* Copyright 2019 Adobe. All rights reserved. This file is licensed to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */var swapImage=function swapImage(container,url,decorateProposition){if(!isImage(container)){return;}// Start downloading the image loadImage(url);decorateProposition(container);// Remove "src" so there is no flicker removeAttribute(container,SRC);// Replace the image "src" setAttribute(container,SRC,url);};/* Copyright 2019 Adobe. All rights reserved. This file is licensed to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */var rearrangeChildren=function rearrangeChildren(container,_ref76,decorateProposition){var from=_ref76.from,to=_ref76.to;var children=getChildren(container);var elementFrom=children[from];var elementTo=children[to];if(!elementFrom||!elementTo){// TODO: We will need to add logging // to ease troubleshooting return;}if(from0&&arguments[0]!==undefined?arguments[0]:document;return doc.location.href.indexOf("adobe_authoring_enabled")!==-1;};/* Copyright 2019 Adobe. All rights reserved. This file is licensed to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ /* eslint-disable no-underscore-dangle */var mergeDecisionsMeta=function mergeDecisionsMeta(event,decisionsMeta,propositionEventTypes,propositionAction){// Do not send a display notification with no decisions. Even empty view changes // should include a proposition. if(decisionsMeta.length===0){return;}var propositionEventType={};propositionEventTypes.forEach(function(type){propositionEventType[type]=EVENT_TYPE_TRUE;});var xdm={_experience:{decisioning:{propositions:decisionsMeta,propositionEventType:propositionEventType}}};if(propositionAction){xdm._experience.decisioning.propositionAction=propositionAction;}event.mergeXdm(xdm);};var mergeQuery=function mergeQuery(event,details){event.mergeQuery({personalization:_objectSpread({},details)});};/* Copyright 2020 Adobe. All rights reserved. This file is licensed to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */var createPropositionAction=function createPropositionAction(clickLabel,clickToken){if(!clickToken&&!clickLabel){return undefined;}var propositionAction={};if(clickLabel){propositionAction.label=clickLabel;}if(clickToken){propositionAction.tokens=[clickToken];}return propositionAction;};var createOnClickHandler=function createOnClickHandler(_ref83){var mergeDecisionsMeta=_ref83.mergeDecisionsMeta,collectInteractions=_ref83.collectInteractions,collectClicks=_ref83.collectClicks,getInteractionMetas=_ref83.getInteractionMetas,getClickMetas=_ref83.getClickMetas,getClickSelectors=_ref83.getClickSelectors,autoCollectPropositionInteractions=_ref83.autoCollectPropositionInteractions;// Called when an element qualifying for conversion within an offer is clicked. return function(_ref84){var event=_ref84.event,clickedElement=_ref84.clickedElement;var decisionsMeta=[];var propositionActionLabel;var propositionActionToken;var viewName;[collectInteractions(clickedElement,getInteractionMetas,autoCollectPropositionInteractions),collectClicks(clickedElement,getClickSelectors(),getClickMetas)].forEach(function(_ref85){var curDecisionsMeta=_ref85.decisionsMeta,curPropositionActionLabel=_ref85.propositionActionLabel,curPropositionActionToken=_ref85.propositionActionToken,curViewName=_ref85.viewName;Array.prototype.push.apply(decisionsMeta,curDecisionsMeta);if(!propositionActionLabel&&curPropositionActionLabel){propositionActionLabel=curPropositionActionLabel;}if(!propositionActionToken&&curPropositionActionToken){propositionActionToken=curPropositionActionToken;}if(!viewName&&curViewName){viewName=curViewName;}});if(isNonEmptyArray(decisionsMeta)){var xdm={eventType:INTERACT};if(viewName){xdm.web={webPageDetails:{viewName:viewName}};}event.mergeXdm(xdm);mergeDecisionsMeta(event,decisionsMeta,[PropositionEventType.INTERACT],createPropositionAction(propositionActionLabel,propositionActionToken));}};};/* Copyright 2020 Adobe. All rights reserved. This file is licensed to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */var createViewCacheManager=function createViewCacheManager(_ref86){var createProposition=_ref86.createProposition;var cacheUpdateCreatedAtLeastOnce=false;var viewStoragePromise=Promise.resolve({});var getViewPropositions=function getViewPropositions(viewStorage,viewName){var viewPropositions=viewStorage[viewName.toLowerCase()];if(viewPropositions&&viewPropositions.length>0){return viewPropositions;}var emptyViewProposition=createProposition({scope:viewName,scopeDetails:{characteristics:{scopeType:VIEW_SCOPE_TYPE}},items:[{schema:DEFAULT_CONTENT_ITEM}]},false);return[emptyViewProposition];};// This should be called before making the request to experience edge. var createCacheUpdate=function createCacheUpdate(viewName){var updateCacheDeferred=defer();cacheUpdateCreatedAtLeastOnce=true;// Additional updates will merge the new view propositions with the old. // i.e. if there are new "cart" view propositions they will overwrite the // old "cart" view propositions, but if there are no new "cart" view // propositions the old "cart" view propositions will remain. viewStoragePromise=viewStoragePromise.then(function(oldViewStorage){return updateCacheDeferred.promise.then(function(newViewStorage){return(0,_reactorObjectAssign["default"])({},oldViewStorage,newViewStorage);})["catch"](function(){return oldViewStorage;});});return{update:function update(viewPropositions){var viewPropositionsWithScope=viewPropositions.filter(function(proposition){return proposition.getScope();});var newViewStorage=groupBy(viewPropositionsWithScope,function(proposition){return proposition.getScope().toLowerCase();});updateCacheDeferred.resolve(newViewStorage);if(viewName){return getViewPropositions(newViewStorage,viewName);}return[];},cancel:function cancel(){updateCacheDeferred.reject();}};};var getView=function getView(viewName){return viewStoragePromise.then(function(viewStorage){return getViewPropositions(viewStorage,viewName);});};var isInitialized=function isInitialized(){return cacheUpdateCreatedAtLeastOnce;};return{createCacheUpdate:createCacheUpdate,getView:getView,isInitialized:isInitialized};};/* Copyright 2020 Adobe. All rights reserved. This file is licensed to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */var createViewChangeHandler=function createViewChangeHandler(_ref87){var processPropositions=_ref87.processPropositions,viewCache=_ref87.viewCache;return function(_ref88){var personalizationDetails=_ref88.personalizationDetails,onResponse=_ref88.onResponse;var returnedPropositions;var returnedDecisions;var viewName=personalizationDetails.getViewName();onResponse(function(){return{propositions:returnedPropositions,decisions:returnedDecisions};});return viewCache.getView(viewName).then(function(propositions){var render;if(personalizationDetails.isRenderDecisions()){var _processPropositions3=processPropositions(propositions);render=_processPropositions3.render;returnedPropositions=_processPropositions3.returnedPropositions;returnedDecisions=_processPropositions3.returnedDecisions;return render();}var _processPropositions4=processPropositions([],propositions);returnedPropositions=_processPropositions4.returnedPropositions;returnedDecisions=_processPropositions4.returnedDecisions;return[];});};};/* Copyright 2020 Adobe. All rights reserved. This file is licensed to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */var metasToArray=function metasToArray(metas){return Object.keys(metas).map(function(key){return _objectSpread({id:key},metas[key]);});};var createClickStorage=function createClickStorage(){var clickStorage={};var storeClickMeta=function storeClickMeta(_ref89){var selector=_ref89.selector,_ref89$meta=_ref89.meta,id=_ref89$meta.id,scope=_ref89$meta.scope,scopeDetails=_ref89$meta.scopeDetails,trackingLabel=_ref89$meta.trackingLabel,scopeType=_ref89$meta.scopeType;if(!clickStorage[selector]){clickStorage[selector]={};}clickStorage[selector][id]={scope:scope,scopeDetails:scopeDetails,trackingLabel:trackingLabel,scopeType:scopeType};};var getClickSelectors=function getClickSelectors(){return Object.keys(clickStorage);};var getClickMetas=function getClickMetas(selector){var metas=clickStorage[selector];if(!metas){return{};}return metasToArray(clickStorage[selector]);};return{storeClickMeta:storeClickMeta,getClickSelectors:getClickSelectors,getClickMetas:getClickMetas};};/* Copyright 2020 Adobe. All rights reserved. This file is licensed to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */var createInteractionStorage=function createInteractionStorage(){var clickMetaStorage={};/* clickMetaStorage example. `abc' and 'def' are proposition IDs. 1 is an interact id. The object with an id, scope and scopeDetails is the notification. { 1: { "abc": { "id": "abc", "scope": "proposition", "scopeDetails": {} }, "def": { "id": "def", "scope": "proposition", "scopeDetails": {} } } } */var clickItemStorage={};/* clickItemStorage example. `abc' and 'def' are proposition IDs. 1 is an interact id. The sets contain proposition-item IDs which are used in notifications that are sent. { 1: { abc: new Set(["itemAAA", "itemCCC"]), def: new Set(["itemEEE", "itemFFF"]), }, } */var storeInteractionMeta=function storeInteractionMeta(propositionId,itemId,scopeType,notification,interactId){// eslint-disable-next-line no-param-reassign interactId=parseInt(interactId,10);if(!clickMetaStorage[interactId]){clickMetaStorage[interactId]={};clickItemStorage[interactId]={};}if(!clickItemStorage[interactId][propositionId]){clickItemStorage[interactId][propositionId]=new Set();}clickItemStorage[interactId][propositionId].add(itemId);clickMetaStorage[interactId][propositionId]=_objectSpread(_objectSpread({},notification),{},{scopeType:scopeType});};var getInteractionMetas=function getInteractionMetas(interactIds){if(!Array.isArray(interactIds)||interactIds.length===0){return[];}return Object.values(interactIds.map(function(value){return parseInt(value,10);}).reduce(function(metaMap,interactId){Object.keys(clickMetaStorage[interactId]||{}).forEach(function(propositionId){if(!metaMap[propositionId]){metaMap[propositionId]={proposition:clickMetaStorage[interactId][propositionId],items:new Set()};}metaMap[propositionId].items=new Set([].concat(_toConsumableArray(metaMap[propositionId].items),_toConsumableArray(clickItemStorage[interactId][propositionId])));});return metaMap;},{})).map(function(_ref90){var proposition=_ref90.proposition,items=_ref90.items;return _objectSpread(_objectSpread({},proposition),{},{items:Array.from(items).map(function(id){return{id:id};})});});};return{storeInteractionMeta:storeInteractionMeta,getInteractionMetas:getInteractionMetas};};/* Copyright 2022 Adobe. All rights reserved. This file is licensed to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */var isInteractionTrackingItem=function isInteractionTrackingItem(schema,actionType){return schema===JSON_CONTENT_ITEM&&actionType===DOM_ACTION_COLLECT_INTERACTIONS;};var SUPPORTED_SCHEMAS=_defineProperty(_defineProperty(_defineProperty(_defineProperty({},DOM_ACTION,function(){return true;}),HTML_CONTENT_ITEM,function(){return true;}),JSON_CONTENT_ITEM,isInteractionTrackingItem),MESSAGE_IN_APP,function(){return true;});var filterItemsPredicate=function filterItemsPredicate(schema,actionType){return typeof SUPPORTED_SCHEMAS[schema]==="function"&&SUPPORTED_SCHEMAS[schema](schema,actionType);};var createApplyPropositions=function createApplyPropositions(_ref91){var processPropositions=_ref91.processPropositions,createProposition=_ref91.createProposition,renderedPropositions=_ref91.renderedPropositions,viewCache=_ref91.viewCache;var updatePropositionItems=function updatePropositionItems(_ref92){var items=_ref92.items,_ref92$metadataForSco=_ref92.metadataForScope,metadataForScope=_ref92$metadataForSco===void 0?{}:_ref92$metadataForSco;var actionType=metadataForScope.actionType,selector=metadataForScope.selector;return items.filter(function(item){return filterItemsPredicate(item.schema,actionType);}).map(function(item){var schema=item.schema;if(schema!==HTML_CONTENT_ITEM&&!isInteractionTrackingItem(schema,actionType)){return _objectSpread({},item);}if(!isEmptyObject(metadataForScope)){return _objectSpread(_objectSpread({},item),{},{schema:isInteractionTrackingItem(schema,actionType)?DOM_ACTION:schema,data:_objectSpread(_objectSpread({},item.data),{},{selector:selector,type:actionType})});}return undefined;}).filter(function(item){return item;});};var filterPropositionsPredicate=function filterPropositionsPredicate(proposition){return!(proposition.scope===PAGE_WIDE_SCOPE&&proposition.renderAttempted);};var preparePropositions=function preparePropositions(_ref93){var propositions=_ref93.propositions,metadata=_ref93.metadata;return propositions.filter(filterPropositionsPredicate).map(function(proposition){if(isNonEmptyArray(proposition.items)){var id=proposition.id,scope=proposition.scope,scopeDetails=proposition.scopeDetails;return{id:id,scope:scope,scopeDetails:scopeDetails,items:updatePropositionItems({items:proposition.items,metadataForScope:metadata[proposition.scope]})};}return proposition;}).filter(function(proposition){return isNonEmptyArray(proposition.items);});};return function(_ref94){var _ref94$propositions=_ref94.propositions,propositions=_ref94$propositions===void 0?[]:_ref94$propositions,_ref94$metadata=_ref94.metadata,metadata=_ref94$metadata===void 0?{}:_ref94$metadata,viewName=_ref94.viewName;// We need to immediately call concat so that subsequent sendEvent // calls will wait for applyPropositions to complete before executing. var renderedPropositionsDeferred=defer();renderedPropositions.concat(renderedPropositionsDeferred.promise);var propositionsToExecute=preparePropositions({propositions:propositions,metadata:metadata}).map(function(proposition){return createProposition(proposition);});return Promise.resolve().then(function(){if(viewName){return viewCache.getView(viewName);}return[];}).then(function(additionalPropositions){var _processPropositions5=processPropositions([].concat(_toConsumableArray(propositionsToExecute),_toConsumableArray(additionalPropositions))),render=_processPropositions5.render,returnedPropositions=_processPropositions5.returnedPropositions;render().then(renderedPropositionsDeferred.resolve);return{propositions:returnedPropositions};});};};/* Copyright 2022 Adobe. All rights reserved. This file is licensed to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */var createGetPageLocation=function createGetPageLocation(_ref95){var window=_ref95.window;return function(){return window.location;};};/* Copyright 2022 Adobe. All rights reserved. This file is licensed to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */var createSetTargetMigration=function createSetTargetMigration(_ref96){var targetMigrationEnabled=_ref96.targetMigrationEnabled;if(targetMigrationEnabled){return function(request){request.getPayload().mergeMeta({target:{migration:true}});};}return noop;};/* Copyright 2021 Adobe. All rights reserved. This file is licensed to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */var TARGET_BODY_SELECTOR="BODY > *:eq(0)";var remapCustomCodeOffers=function remapCustomCodeOffers(action){var selector=action.selector,type=action.type;if(type!==DOM_ACTION_CUSTOM_CODE){return action;}if(selector!==TARGET_BODY_SELECTOR){return action;}return(0,_reactorObjectAssign["default"])({},action,{selector:"BODY"});};/* Copyright 2021 Adobe. All rights reserved. This file is licensed to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ /** * Returns whether a string value is blank. Also returns true if the value is not a string. * @param {*} value * @returns {boolean} */var isBlankString=function isBlankString(value){return isString(value)?!value.trim():true;};/* Copyright 2021 Adobe. All rights reserved. This file is licensed to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */var HEAD_TAGS_SELECTOR="SCRIPT,LINK,STYLE";var filterHeadContent=function filterHeadContent(content){var container=createFragment(content);var headNodes=selectNodes(HEAD_TAGS_SELECTOR,container);return headNodes.map(function(node){return node.outerHTML;}).join("");};var remapHeadOffers=function remapHeadOffers(action){var result=(0,_reactorObjectAssign["default"])({},action);var content=result.content,selector=result.selector;if(isBlankString(content)){return result;}if(selector==null){return result;}var container=selectNodesWithEq(selector);if(!is(container[0],HEAD)){return result;}result.type=DOM_ACTION_APPEND_HTML;result.content=filterHeadContent(content);return result;};/* Copyright 2023 Adobe. All rights reserved. This file is licensed to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */var createPreprocess=function createPreprocess(preprocessors){return function(action){if(!action){return action;}return preprocessors.reduce(function(processed,fn){return(0,_reactorObjectAssign["default"])(processed,fn(processed));},action);};};/* Copyright 2023 Adobe. All rights reserved. This file is licensed to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */var injectCreateProposition=function injectCreateProposition(_ref97){var preprocess=_ref97.preprocess,isPageWideSurface=_ref97.isPageWideSurface;var createItem=function createItem(item,proposition){var id=item.id,schema=item.schema,data=item.data,_item$characteristics=item.characteristics,_item$characteristics2=_item$characteristics===void 0?{}:_item$characteristics,trackingLabel=_item$characteristics2.trackingLabel;var schemaType=data?data.type:undefined;var processedData=preprocess(data);return{getId:function getId(){return id;},getSchema:function getSchema(){return schema;},getSchemaType:function getSchemaType(){return schemaType;},getData:function getData(){return processedData;},getProposition:function getProposition(){return proposition;},getTrackingLabel:function getTrackingLabel(){return trackingLabel;},getOriginalItem:function getOriginalItem(){return item;},toString:function toString(){return JSON.stringify(item);},toJSON:function toJSON(){return item;}};};return function(payload){var visibleInReturnedItems=arguments.length>1&&arguments[1]!==undefined?arguments[1]:true;var id=payload.id,scope=payload.scope,scopeDetails=payload.scopeDetails,_payload$items=payload.items,items=_payload$items===void 0?[]:_payload$items;var _ref98=scopeDetails||{},_ref98$characteristic=_ref98.characteristics,_ref98$characteristic2=_ref98$characteristic===void 0?{}:_ref98$characteristic,scopeType=_ref98$characteristic2.scopeType;return{getScope:function getScope(){if(!scope){return scope;}return scope;},getScopeType:function getScopeType(){if(scope===PAGE_WIDE_SCOPE||isPageWideSurface(scope)){return PAGE_SCOPE_TYPE;}if(scopeType===VIEW_SCOPE_TYPE){return VIEW_SCOPE_TYPE;}return PROPOSITION_SCOPE_TYPE;},getItems:function getItems(){var _this6=this;return items.map(function(item){return createItem(item,_this6);});},getNotification:function getNotification(){return{id:id,scope:scope,scopeDetails:scopeDetails};},getId:function getId(){return id;},toJSON:function toJSON(){return payload;},addToReturnValues:function addToReturnValues(propositions,decisions,includedItems,renderAttempted){if(visibleInReturnedItems){propositions.push(_objectSpread(_objectSpread({},payload),{},{items:includedItems.map(function(i){return i.getOriginalItem();}),renderAttempted:renderAttempted}));if(!renderAttempted){decisions.push(_objectSpread(_objectSpread({},payload),{},{items:includedItems.map(function(i){return i.getOriginalItem();})}));}}}};};};/* Copyright 2023 Adobe. All rights reserved. This file is licensed to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */var createAsyncArray=function createAsyncArray(){var latest=Promise.resolve([]);return{concat:function concat(promise){latest=latest.then(function(existingPropositions){return promise.then(function(newPropositions){return existingPropositions.concat(newPropositions);})["catch"](function(){return existingPropositions;});});},/** * Clears the saved propositions, waiting until the next propositions are resolved and available. * * @returns {Promise} A promise that resolves to the latest propositions. */clear:function clear(){var oldLatest=latest;latest=Promise.resolve([]);return oldLatest;}};};/* Copyright 2023 Adobe. All rights reserved. This file is licensed to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */var processDefaultContent=function processDefaultContent(){return{setRenderAttempted:true,includeInNotification:true};};/* Copyright 2024 Adobe. All rights reserved. This file is licensed to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */var ALWAYS="always";var NEVER="never";var DECORATED_ELEMENTS_ONLY="decoratedElementsOnly";var PROPOSITION_INTERACTION_TYPES=[ALWAYS,NEVER,DECORATED_ELEMENTS_ONLY];/* Copyright 2024 Adobe. All rights reserved. This file is licensed to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */var INTERACT_ID_DATA_ATTRIBUTE="data-aep-interact-id";var CLICK_LABEL_DATA_ATTRIBUTE="data-aep-click-label";var CLICK_TOKEN_DATA_ATTRIBUTE="data-aep-click-token";var lastInteractId=0;var getInteractId=function getInteractId(propositionId,existingInteractId){if(existingInteractId){return parseInt(existingInteractId,10);}// eslint-disable-next-line no-plusplus return++lastInteractId;};var interactionTrackingSupported=function interactionTrackingSupported(autoCollectPropositionInteractions,decisionProvider){if(!autoCollectPropositionInteractions){return false;}if(!autoCollectPropositionInteractions[decisionProvider]){return false;}return includes([ALWAYS,DECORATED_ELEMENTS_ONLY],autoCollectPropositionInteractions[decisionProvider]);};var createDecorateProposition=function createDecorateProposition(autoCollectPropositionInteractions,type,propositionId,itemId,trackingLabel,scopeType,notification,storeInteractionMeta){var _notification$scopeDe=notification.scopeDetails,scopeDetails=_notification$scopeDe===void 0?{}:_notification$scopeDe;var decisionProvider=scopeDetails.decisionProvider;if(!interactionTrackingSupported(autoCollectPropositionInteractions,decisionProvider)&&type!==DOM_ACTION_CLICK){return noop;}return function(element){if(!element.tagName){return;}var interactId=getInteractId(propositionId,getAttribute(element,INTERACT_ID_DATA_ATTRIBUTE));storeInteractionMeta(propositionId,itemId,scopeType,notification,interactId);setAttribute(element,INTERACT_ID_DATA_ATTRIBUTE,interactId);if(trackingLabel&&!getAttribute(element,CLICK_LABEL_DATA_ATTRIBUTE)){setAttribute(element,CLICK_LABEL_DATA_ATTRIBUTE,trackingLabel);}};};/* Copyright 2023 Adobe. All rights reserved. This file is licensed to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */var createProcessDomAction=function createProcessDomAction(_ref99){var modules=_ref99.modules,logger=_ref99.logger,storeInteractionMeta=_ref99.storeInteractionMeta,storeClickMeta=_ref99.storeClickMeta,autoCollectPropositionInteractions=_ref99.autoCollectPropositionInteractions;return function(item){var _ref100=item.getData()||{},type=_ref100.type,selector=_ref100.selector;if(!type){logger.warn("Invalid DOM action data: missing type.",item.getData());return{setRenderAttempted:false,includeInNotification:false};}if(type===DOM_ACTION_CLICK){if(!selector){logger.warn("Invalid DOM action data: missing selector.",item.getData());return{setRenderAttempted:false,includeInNotification:false};}storeClickMeta({selector:selector,meta:_objectSpread(_objectSpread({},item.getProposition().getNotification()),{},{trackingLabel:item.getTrackingLabel(),scopeType:item.getProposition().getScopeType()})});return{setRenderAttempted:true,includeInNotification:false};}if(!modules[type]){logger.warn("Invalid DOM action data: unknown type.",item.getData());return{setRenderAttempted:false,includeInNotification:false};}var decorateProposition=createDecorateProposition(autoCollectPropositionInteractions,type,item.getProposition().getId(),item.getId(),item.getTrackingLabel(),item.getProposition().getScopeType(),item.getProposition().getNotification(),storeInteractionMeta);return{render:function render(){return modules[type](item.getData(),decorateProposition);},setRenderAttempted:true,includeInNotification:true};};};/* Copyright 2023 Adobe. All rights reserved. This file is licensed to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */var createProcessHtmlContent=function createProcessHtmlContent(_ref101){var modules=_ref101.modules,logger=_ref101.logger,storeInteractionMeta=_ref101.storeInteractionMeta,autoCollectPropositionInteractions=_ref101.autoCollectPropositionInteractions;return function(item){var _ref102=item.getData()||{},type=_ref102.type,selector=_ref102.selector;if(!selector||!type){return{setRenderAttempted:false,includeInNotification:false};}if(!modules[type]){logger.warn("Invalid HTML content data",item.getData());return{setRenderAttempted:false,includeInNotification:false};}var decorateProposition=createDecorateProposition(autoCollectPropositionInteractions,type,item.getProposition().getId(),item.getId(),item.getTrackingLabel(),item.getProposition().getScopeType(),item.getProposition().getNotification(),storeInteractionMeta);return{render:function render(){return modules[type](item.getData(),decorateProposition);},setRenderAttempted:true,includeInNotification:true};};};/* Copyright 2023 Adobe. All rights reserved. This file is licensed to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */var createProcessRedirect=function createProcessRedirect(_ref103){var logger=_ref103.logger,executeRedirect=_ref103.executeRedirect,collect=_ref103.collect;return function(item){var _ref104=item.getData()||{},content=_ref104.content;if(!content){logger.warn("Invalid Redirect data",item.getData());return{};}var render=function render(){return collect({decisionsMeta:[item.getProposition().getNotification()],documentMayUnload:true}).then(function(){return executeRedirect(content);// Execute redirect will never resolve. If there are bottom of page events that are waiting // for display notifications from this request, they will never run because this promise will // not resolve. This is intentional because we don't want to run bottom of page events if // there is a redirect. });};return{render:render,setRenderAttempted:true,onlyRenderThis:true};};};/* Copyright 2023 Adobe. All rights reserved. This file is licensed to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */var createProcessPropositions=function createProcessPropositions(_ref105){var schemaProcessors=_ref105.schemaProcessors,logger=_ref105.logger;var wrapRenderWithLogging=function wrapRenderWithLogging(render,item){return function(){return Promise.resolve().then(render).then(function(){if(logger.enabled){logger.info("Action ".concat(item.toString()," executed."));}return true;})["catch"](function(error){if(logger.enabled){var message=error.message,stack=error.stack;var warning="Failed to execute action ".concat(item.toString(),". ").concat(message," ").concat(stack);logger.warn(warning);}return false;});};};var renderItems=function renderItems(renderers,meta){return Promise.all(renderers.map(function(renderer){return renderer();})).then(function(successes){// as long as at least one renderer succeeds, we want to add the notification // to the display notifications if(!successes.includes(true)){return undefined;}return meta;});};var processItem=function processItem(item){var processor=schemaProcessors[item.getSchema()];if(!processor){return{};}return processor(item);};var processItems=function processItems(_ref106){var existingRenderers=_ref106.renderers,existingReturnedPropositions=_ref106.returnedPropositions,existingReturnedDecisions=_ref106.returnedDecisions,items=_ref106.items,proposition=_ref106.proposition;var renderers=_toConsumableArray(existingRenderers);var returnedPropositions=_toConsumableArray(existingReturnedPropositions);var returnedDecisions=_toConsumableArray(existingReturnedDecisions);var renderedItems=[];var nonRenderedItems=[];var itemRenderers=[];var atLeastOneWithNotification=false;var render;var setRenderAttempted;var includeInNotification;var onlyRenderThis=false;var i=0;var item;while(items.length>i){item=items[i];var _processItem=processItem(item);render=_processItem.render;setRenderAttempted=_processItem.setRenderAttempted;includeInNotification=_processItem.includeInNotification;onlyRenderThis=_processItem.onlyRenderThis;if(onlyRenderThis){returnedPropositions=[];returnedDecisions=[];if(setRenderAttempted){renderedItems=[item];nonRenderedItems=[];}else{renderedItems=[];nonRenderedItems=[item];}renderers=[];itemRenderers=[render];atLeastOneWithNotification=includeInNotification;break;}if(render){itemRenderers.push(wrapRenderWithLogging(render,item));}if(includeInNotification){atLeastOneWithNotification=true;}if(setRenderAttempted){renderedItems.push(item);}else{nonRenderedItems.push(item);}i+=1;}if(itemRenderers.length>0){var meta=atLeastOneWithNotification?proposition.getNotification():undefined;renderers.push(function(){return renderItems(itemRenderers,meta);});}else if(atLeastOneWithNotification){renderers.push(function(){return Promise.resolve(proposition.getNotification());});}if(renderedItems.length>0){proposition.addToReturnValues(returnedPropositions,returnedDecisions,renderedItems,true);}if(nonRenderedItems.length>0){proposition.addToReturnValues(returnedPropositions,returnedDecisions,nonRenderedItems,false);}return{renderers:renderers,returnedPropositions:returnedPropositions,returnedDecisions:returnedDecisions,onlyRenderThis:onlyRenderThis};};return function(renderPropositions){var nonRenderPropositions=arguments.length>1&&arguments[1]!==undefined?arguments[1]:[];var renderers=[];var returnedPropositions=[];var returnedDecisions=[];var onlyRenderThis;var i=0;var proposition;var items;while(renderPropositions.length>i){proposition=renderPropositions[i];items=proposition.getItems();var _processItems=processItems({renderers:renderers,returnedPropositions:returnedPropositions,returnedDecisions:returnedDecisions,items:items,proposition:proposition});renderers=_processItems.renderers;returnedPropositions=_processItems.returnedPropositions;returnedDecisions=_processItems.returnedDecisions;onlyRenderThis=_processItems.onlyRenderThis;if(onlyRenderThis){break;}i+=1;}if(onlyRenderThis){// if onlyRenderThis is true, that means returnedPropositions and returnedDecisions // only contains the proposition that triggered only rendering this. We need to // add the other propositions to the returnedPropositions and returnedDecisions. renderPropositions.forEach(function(p,index){if(index!==i){p.addToReturnValues(returnedPropositions,returnedDecisions,p.getItems(),false);}});}nonRenderPropositions.forEach(function(p){p.addToReturnValues(returnedPropositions,returnedDecisions,p.getItems(),false);});var render=function render(){return Promise.all(renderers.map(function(renderer){return renderer();})).then(function(metas){return metas.filter(function(meta){return meta;});});};return{returnedPropositions:returnedPropositions,returnedDecisions:returnedDecisions,render:render};};};/* Copyright 2023 Adobe. All rights reserved. This file is licensed to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */var createOnDecisionHandler=function createOnDecisionHandler(_ref107){var processPropositions=_ref107.processPropositions,createProposition=_ref107.createProposition,notificationHandler=_ref107.notificationHandler;return function(_ref108){var renderDecisions=_ref108.renderDecisions,propositions=_ref108.propositions,event=_ref108.event,_ref108$personalizati=_ref108.personalization,personalization=_ref108$personalizati===void 0?{}:_ref108$personalizati;if(!renderDecisions){return Promise.resolve();}var _personalization$send=personalization.sendDisplayEvent,sendDisplayEvent=_personalization$send===void 0?true:_personalization$send;var viewName=event?event.getViewName():undefined;var propositionsToExecute=propositions.map(function(proposition){return createProposition(proposition,true);});var _processPropositions6=processPropositions(propositionsToExecute),render=_processPropositions6.render,returnedPropositions=_processPropositions6.returnedPropositions;var handleNotifications=notificationHandler(renderDecisions,sendDisplayEvent,viewName);render().then(handleNotifications);return Promise.resolve({propositions:returnedPropositions});};};/* Copyright 2023 Adobe. All rights reserved. This file is licensed to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */var TEXT_HTML="text/html";var APPLICATION_JSON="application/json";/* Copyright 2023 Adobe. All rights reserved. This file is licensed to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */var DEFAULT_CONTENT="defaultContent";var expectedProps=["content","contentType"];var expectedContentProps=["mobileParameters","webParameters","html"];var isValidInAppMessage=function isValidInAppMessage(data,logger){for(var _i13=0;_i130){removeNode(element[0]);}};var parseAnchor=function parseAnchor(anchor){var nothing={};if(!anchor||anchor.tagName.toLowerCase()!=="a"){return nothing;}var href=anchor.href;if(!href||!startsWith(href,"adbinapp://")){return nothing;}var hrefParts=href.split("?");var action=hrefParts[0].split("://")[1];var label=anchor.innerText;var uuid=anchor.getAttribute("data-uuid")||"";var interaction;var link;if(isNonEmptyArray(hrefParts)){var queryParams=_reactorQueryString["default"].parse(hrefParts[1]);interaction=queryParams.interaction||"";link=decodeURIComponent(queryParams.link||"");}return{action:action,interaction:interaction,link:link,label:label,uuid:uuid};};/* Copyright 2019 Adobe. All rights reserved. This file is licensed to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */var createRedirect=function createRedirect(window){return function(url){var preserveHistory=arguments.length>1&&arguments[1]!==undefined?arguments[1]:false;if(preserveHistory){window.location.href=url;}else{window.location.replace(url);}// Return a promise that never resolves because redirects never complete // within the current page. return new Promise(function(){});};};/* Copyright 2023 Adobe. All rights reserved. This file is licensed to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */var MESSAGING_CONTAINER_ID="alloy-messaging-container";var OVERLAY_CONTAINER_ID="alloy-overlay-container";var IFRAME_ID="alloy-content-iframe";var dismissMessage=function dismissMessage(){return[MESSAGING_CONTAINER_ID,OVERLAY_CONTAINER_ID].forEach(removeElementById);};var createIframeClickHandler=function createIframeClickHandler(interact){var navigateToUrl=arguments.length>1&&arguments[1]!==undefined?arguments[1]:createRedirect(window);return function(event){event.preventDefault();event.stopImmediatePropagation();var target=event.target;var anchor=target.tagName.toLowerCase()==="a"?target:target.closest("a");if(!anchor){return;}var _parseAnchor=parseAnchor(anchor),action=_parseAnchor.action,interaction=_parseAnchor.interaction,link=_parseAnchor.link,label=_parseAnchor.label,uuid=_parseAnchor.uuid;interact(action,{label:label,id:interaction,uuid:uuid,link:link});if(action==="dismiss"){dismissMessage();}if(isNonEmptyString(link)&&link.length>0){navigateToUrl(link,true);}};};var createIframe=function createIframe(htmlContent,clickHandler){var parser=new DOMParser();var htmlDocument=parser.parseFromString(htmlContent,TEXT_HTML);var scriptTag=htmlDocument.querySelector("script");if(scriptTag){scriptTag.setAttribute("nonce",getNonce());}var element=createNode("iframe",{src:URL.createObjectURL(new Blob([htmlDocument.documentElement.outerHTML],{type:"text/html"})),id:IFRAME_ID});element.addEventListener("load",function(){var _ref110=element.contentDocument||element.contentWindow.document,addEventListener=_ref110.addEventListener;addEventListener("click",clickHandler);});return element;};var renderMessage=function renderMessage(iframe,webParameters,container,overlay){[{id:OVERLAY_CONTAINER_ID,element:overlay},{id:MESSAGING_CONTAINER_ID,element:container},{id:IFRAME_ID,element:iframe}].forEach(function(_ref111){var id=_ref111.id,element=_ref111.element;var _webParameters$id=webParameters[id],_webParameters$id$sty=_webParameters$id.style,style=_webParameters$id$sty===void 0?{}:_webParameters$id$sty,_webParameters$id$par=_webParameters$id.params,params=_webParameters$id$par===void 0?{}:_webParameters$id$par;(0,_reactorObjectAssign["default"])(element.style,style);var _params$parentElement=params.parentElement,parentElement=_params$parentElement===void 0?"body":_params$parentElement,_params$insertionMeth=params.insertionMethod,insertionMethod=_params$insertionMeth===void 0?"appendChild":_params$insertionMeth,_params$enabled=params.enabled,enabled=_params$enabled===void 0?true:_params$enabled;var parent=document.querySelector(parentElement);if(enabled&&parent&&typeof parent[insertionMethod]==="function"){parent[insertionMethod](element);}});};var buildStyleFromMobileParameters=function buildStyleFromMobileParameters(mobileParameters){var verticalAlign=mobileParameters.verticalAlign,width=mobileParameters.width,horizontalAlign=mobileParameters.horizontalAlign,backdropColor=mobileParameters.backdropColor,height=mobileParameters.height,cornerRadius=mobileParameters.cornerRadius,horizontalInset=mobileParameters.horizontalInset,verticalInset=mobileParameters.verticalInset,_mobileParameters$uiT=mobileParameters.uiTakeover,uiTakeover=_mobileParameters$uiT===void 0?false:_mobileParameters$uiT;var style={width:width?"".concat(width,"%"):"100%",backgroundColor:backdropColor||"rgba(0, 0, 0, 0.5)",borderRadius:cornerRadius?"".concat(cornerRadius,"px"):"0px",border:"none",position:uiTakeover?"fixed":"relative",overflow:"hidden"};if(horizontalAlign==="left"){style.left=horizontalInset?"".concat(horizontalInset,"%"):"0";}else if(horizontalAlign==="right"){style.right=horizontalInset?"".concat(horizontalInset,"%"):"0";}else if(horizontalAlign==="center"){style.left="50%";style.transform="translateX(-50%)";}if(verticalAlign==="top"){style.top=verticalInset?"".concat(verticalInset,"%"):"0";}else if(verticalAlign==="bottom"){style.position="fixed";style.bottom=verticalInset?"".concat(verticalInset,"%"):"0";}else if(verticalAlign==="center"){style.top="50%";style.transform="".concat(horizontalAlign==="center"?"".concat(style.transform," "):"","translateY(-50%)");style.display="flex";style.alignItems="center";style.justifyContent="center";}if(height){style.height="".concat(height,"vh");}else{style.height="100%";}return style;};var mobileOverlay=function mobileOverlay(mobileParameters){var backdropOpacity=mobileParameters.backdropOpacity,backdropColor=mobileParameters.backdropColor;var opacity=backdropOpacity||0.5;var color=backdropColor||"#FFFFFF";var style={position:"fixed",top:"0",left:"0",width:"100%",height:"100%",background:"transparent",opacity:opacity,backgroundColor:color};return style;};var REQUIRED_PARAMS=["enabled","parentElement","insertionMethod"];var isValidWebParameters=function isValidWebParameters(webParameters){if(!webParameters){return false;}var ids=Object.keys(webParameters);if(!includes(ids,MESSAGING_CONTAINER_ID)){return false;}if(!includes(ids,OVERLAY_CONTAINER_ID)){return false;}var valuesArray=values(webParameters);for(var _i15=0;_i150&&arguments[0]!==undefined?arguments[0]:{};var interact=arguments.length>1?arguments[1]:undefined;dismissMessage();var content=settings.content,contentType=settings.contentType,mobileParameters=settings.mobileParameters;var webParameters=settings.webParameters;if(contentType!==TEXT_HTML){return;}var container=createNode("div",{id:MESSAGING_CONTAINER_ID});var iframe=createIframe(content,createIframeClickHandler(interact));var overlay=createNode("div",{id:OVERLAY_CONTAINER_ID});if(!isValidWebParameters(webParameters)){webParameters=generateWebParameters(mobileParameters);}if(!webParameters){return;}renderMessage(iframe,webParameters,container,overlay);};var displayIframeContent=function displayIframeContent(settings,collect){return new Promise(function(resolve){var meta=settings.meta;displayHTMLContentInIframe(settings,function(action,propositionAction){var propositionEventTypes={};propositionEventTypes[PropositionEventType.INTERACT]=EVENT_TYPE_TRUE;if(Object.values(PropositionEventType).indexOf(action)!==-1){propositionEventTypes[action]=EVENT_TYPE_TRUE;}collect({decisionsMeta:[meta],propositionAction:propositionAction,eventType:INTERACT,propositionEventTypes:Object.keys(propositionEventTypes)});});resolve({meta:meta});});};/* Copyright 2023 Adobe. All rights reserved. This file is licensed to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */var initInAppMessageActionsModules=function initInAppMessageActionsModules(collect){return{defaultContent:function defaultContent(settings){return displayIframeContent(settings,collect);}};};/* Copyright 2023 Adobe. All rights reserved. This file is licensed to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */var createNotificationHandler=function createNotificationHandler(collect,renderedPropositions){return function(isRenderDecisions,isSendDisplayEvent,viewName){if(!isRenderDecisions){// If we aren't rendering anything, then we don't need to sendDisplayEvents. return function(){return undefined;};}if(!isSendDisplayEvent){var renderedPropositionsDeferred=defer();renderedPropositions.concat(renderedPropositionsDeferred.promise);return renderedPropositionsDeferred.resolve;}return function(decisionsMeta){if(decisionsMeta.length>0){collect({decisionsMeta:decisionsMeta,viewName:viewName});}};};};/* Copyright 2024 Adobe. All rights reserved. This file is licensed to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */var createHandleConsentFlicker=function createHandleConsentFlicker(_ref113){var showContainers=_ref113.showContainers,consent=_ref113.consent;return function(){var _consent$current2=consent.current(),state=_consent$current2.state,wasSet=_consent$current2.wasSet;if(state===OUT&&wasSet){showContainers();}else{consent.awaitConsent()["catch"](showContainers);}};};/* Copyright 2019 Adobe. All rights reserved. This file is licensed to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */var getInteractionDetail=function getInteractionDetail(clickedElement){var _document2=document,documentElement=_document2.documentElement;var element=clickedElement;var interactIds=new Set();var clickLabel;var clickToken;while(element&&element!==documentElement){var interactId=getAttribute(element,INTERACT_ID_DATA_ATTRIBUTE);if(interactId){interactIds.add(interactId);}clickLabel=clickLabel||getAttribute(element,CLICK_LABEL_DATA_ATTRIBUTE);clickToken=clickToken||getAttribute(element,CLICK_TOKEN_DATA_ATTRIBUTE);element=element.parentNode;}return{interactIds:_toConsumableArray(interactIds),clickLabel:clickLabel,clickToken:clickToken};};var extractViewName=function extractViewName(metas){var foundMetaWithScopeTypeView=metas.find(function(meta){return meta.scopeType===VIEW_SCOPE_TYPE;});return foundMetaWithScopeTypeView?foundMetaWithScopeTypeView.scope:undefined;};var createMetaFilter=function createMetaFilter(autoCollectPropositionInteractions,clickLabel,clickToken){return function(meta){var _meta$scopeDetails=meta.scopeDetails,scopeDetails=_meta$scopeDetails===void 0?{}:_meta$scopeDetails;var decisionProvider=scopeDetails.decisionProvider;if(autoCollectPropositionInteractions[decisionProvider]===ALWAYS){return true;}return autoCollectPropositionInteractions[decisionProvider]===DECORATED_ELEMENTS_ONLY&&(clickLabel||clickToken);};};var collectInteractions=function collectInteractions(clickedElement,getInteractionMetas,autoCollectPropositionInteractions){var _getInteractionDetail=getInteractionDetail(clickedElement),interactIds=_getInteractionDetail.interactIds,_getInteractionDetail2=_getInteractionDetail.clickLabel,clickLabel=_getInteractionDetail2===void 0?"":_getInteractionDetail2,clickToken=_getInteractionDetail.clickToken;var metasMatchingConfigurationOptions=createMetaFilter(autoCollectPropositionInteractions,clickLabel,clickToken);if(interactIds.length===0){return{};}var metas=getInteractionMetas(interactIds).filter(metasMatchingConfigurationOptions);return{decisionsMeta:cleanMetas(metas),propositionActionLabel:clickLabel,propositionActionToken:clickToken,viewName:extractViewName(metas)};};/* Copyright 2023 Adobe. All rights reserved. This file is licensed to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */var ADOBE_JOURNEY_OPTIMIZER="AJO";var ADOBE_TARGET="TGT";/* Copyright 2019 Adobe. Ackll rights reserved. This file is licensed to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */var createPersonalization=function createPersonalization(_ref114){var config=_ref114.config,logger=_ref114.logger,eventManager=_ref114.eventManager,consent=_ref114.consent;var targetMigrationEnabled=config.targetMigrationEnabled,prehidingStyle=config.prehidingStyle,autoCollectPropositionInteractions=config.autoCollectPropositionInteractions;var collect=createCollect({eventManager:eventManager,mergeDecisionsMeta:mergeDecisionsMeta});var _createInteractionSto=createInteractionStorage(),storeInteractionMeta=_createInteractionSto.storeInteractionMeta,getInteractionMetas=_createInteractionSto.getInteractionMetas;var _createClickStorage=createClickStorage(),storeClickMeta=_createClickStorage.storeClickMeta,getClickSelectors=_createClickStorage.getClickSelectors,getClickMetas=_createClickStorage.getClickMetas;var getPageLocation=createGetPageLocation({window:window});var domActionsModules=initDomActionsModules();var preprocess=createPreprocess([remapHeadOffers,remapCustomCodeOffers]);var createProposition=injectCreateProposition({preprocess:preprocess,isPageWideSurface:isPageWideSurface});var viewCache=createViewCacheManager({createProposition:createProposition});var executeRedirect=createRedirect(window);var schemaProcessors=_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({},DEFAULT_CONTENT_ITEM,processDefaultContent),DOM_ACTION,createProcessDomAction({modules:domActionsModules,logger:logger,storeInteractionMeta:storeInteractionMeta,storeClickMeta:storeClickMeta,autoCollectPropositionInteractions:autoCollectPropositionInteractions})),HTML_CONTENT_ITEM,createProcessHtmlContent({modules:domActionsModules,logger:logger,storeInteractionMeta:storeInteractionMeta,autoCollectPropositionInteractions:autoCollectPropositionInteractions})),REDIRECT_ITEM,createProcessRedirect({logger:logger,executeRedirect:executeRedirect,collect:collect})),MESSAGE_IN_APP,createProcessInAppMessage({modules:initInAppMessageActionsModules(collect),logger:logger}));var processPropositions=createProcessPropositions({schemaProcessors:schemaProcessors,logger:logger});var renderedPropositions=createAsyncArray();var notificationHandler=createNotificationHandler(collect,renderedPropositions);var fetchDataHandler=createFetchDataHandler({prehidingStyle:prehidingStyle,showContainers:showContainers,hideContainers:hideContainers,mergeQuery:mergeQuery,processPropositions:processPropositions,createProposition:createProposition,notificationHandler:notificationHandler,consent:consent});var onClickHandler=createOnClickHandler({mergeDecisionsMeta:mergeDecisionsMeta,collectInteractions:collectInteractions,collectClicks:collectClicks,getInteractionMetas:getInteractionMetas,getClickMetas:getClickMetas,getClickSelectors:getClickSelectors,autoCollectPropositionInteractions:autoCollectPropositionInteractions});var viewChangeHandler=createViewChangeHandler({processPropositions:processPropositions,viewCache:viewCache});var applyPropositions=createApplyPropositions({processPropositions:processPropositions,createProposition:createProposition,renderedPropositions:renderedPropositions,viewCache:viewCache});var setTargetMigration=createSetTargetMigration({targetMigrationEnabled:targetMigrationEnabled});var onDecisionHandler=createOnDecisionHandler({processPropositions:processPropositions,createProposition:createProposition,notificationHandler:notificationHandler});var handleConsentFlicker=createHandleConsentFlicker({showContainers:showContainers,consent:consent});return createComponent$3({getPageLocation:getPageLocation,logger:logger,fetchDataHandler:fetchDataHandler,viewChangeHandler:viewChangeHandler,onClickHandler:onClickHandler,isAuthoringModeEnabled:isAuthoringModeEnabled,mergeQuery:mergeQuery,viewCache:viewCache,showContainers:showContainers,applyPropositions:applyPropositions,setTargetMigration:setTargetMigration,mergeDecisionsMeta:mergeDecisionsMeta,renderedPropositions:renderedPropositions,onDecisionHandler:onDecisionHandler,handleConsentFlicker:handleConsentFlicker});};createPersonalization.namespace="Personalization";var interactionConfigOptions=PROPOSITION_INTERACTION_TYPES.map(function(propositionInteractionType){return boundLiteral(propositionInteractionType);});createPersonalization.configValidators=boundObjectOf({prehidingStyle:boundString().nonEmpty(),targetMigrationEnabled:boundBoolean()["default"](false),autoCollectPropositionInteractions:boundObjectOf(_defineProperty(_defineProperty({},ADOBE_JOURNEY_OPTIMIZER,boundAnyOf(interactionConfigOptions)["default"](ALWAYS)),ADOBE_TARGET,boundAnyOf(interactionConfigOptions)["default"](NEVER)))["default"](_defineProperty(_defineProperty({},ADOBE_JOURNEY_OPTIMIZER,ALWAYS),ADOBE_TARGET,NEVER)).noUnknownFields()});/* Copyright 2019 Adobe. All rights reserved. This file is licensed to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */var injectWeb=function injectWeb(window){return function(xdm){var web={webPageDetails:{URL:window.location.href||window.location},webReferrer:{URL:window.document.referrer}};deepAssign(xdm,{web:web});};};/* Copyright 2019 Adobe. All rights reserved. This file is licensed to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */var getScreenOrientationViaProperty=function getScreenOrientationViaProperty(window){var orientation=window.screen.orientation;if(orientation==null||orientation.type==null){return null;}var parts=orientation.type.split("-");if(parts.length===0){return null;}if(parts[0]!=="portrait"&&parts[0]!=="landscape"){return null;}return parts[0];};var getScreenOrientationViaMediaQuery=function getScreenOrientationViaMediaQuery(window){if(isFunction(window.matchMedia)){if(window.matchMedia("(orientation: portrait)").matches){return"portrait";}if(window.matchMedia("(orientation: landscape)").matches){return"landscape";}}return null;};var injectDevice=function injectDevice(window){return function(xdm){var _window$screen=window.screen,width=_window$screen.width,height=_window$screen.height;var device={};var screenHeight=toInteger(height);if(screenHeight>=0){device.screenHeight=screenHeight;}var screenWidth=toInteger(width);if(screenWidth>=0){device.screenWidth=screenWidth;}var orientation=getScreenOrientationViaProperty(window)||getScreenOrientationViaMediaQuery(window);if(orientation){device.screenOrientation=orientation;}if(Object.keys(device).length>0){deepAssign(xdm,{device:device});}};};/* Copyright 2019 Adobe. All rights reserved. This file is licensed to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */var injectEnvironment=function injectEnvironment(window){return function(xdm){var _window$document$docu=window.document.documentElement,_window$document$docu2=_window$document$docu===void 0?{}:_window$document$docu,clientWidth=_window$document$docu2.clientWidth,clientHeight=_window$document$docu2.clientHeight;var environment={type:"browser"};var viewportWidth=toInteger(clientWidth);if(viewportWidth>=0){environment.browserDetails={viewportWidth:viewportWidth};}var viewportHeight=toInteger(clientHeight);if(viewportHeight>=0){environment.browserDetails=environment.browserDetails||{};environment.browserDetails.viewportHeight=viewportHeight;}deepAssign(xdm,{environment:environment});};};/* Copyright 2019 Adobe. All rights reserved. This file is licensed to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */var injectPlaceContext=function injectPlaceContext(dateProvider){return function(xdm){var date=dateProvider();var placeContext={};var localTimezoneOffset=toInteger(date.getTimezoneOffset());if(localTimezoneOffset!==undefined){placeContext.localTimezoneOffset=localTimezoneOffset;}// make sure the timezone offset only uses two digits if(localTimezoneOffset===undefined||Math.abs(localTimezoneOffset)<6000){placeContext.localTime=toISOStringLocal(date);}deepAssign(xdm,{placeContext:placeContext});};};/* Copyright 2019 Adobe. All rights reserved. This file is licensed to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */var injectTimestamp=function injectTimestamp(dateProvider){return function(xdm){var timestamp=dateProvider().toISOString();deepAssign(xdm,{timestamp:timestamp});};};/* Copyright 2020 Adobe. All rights reserved. This file is licensed to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */var libraryName="https://ns.adobe.com/experience/alloy";/* Copyright 2020 Adobe. All rights reserved. This file is licensed to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ // The __VERSION__ keyword will be replace at alloy build time with the package.json version. // see babel-plugin-version var libraryVersion="2.21.1";/* Copyright 2019 Adobe. All rights reserved. This file is licensed to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */var implementationDetails=function implementationDetails(xdm){var implementationDetails={name:libraryName,version:libraryVersion,environment:"browser"};deepAssign(xdm,{implementationDetails:implementationDetails});};/* Copyright 2019 Adobe. All rights reserved. This file is licensed to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */var createComponent$2=function createComponent$2(config,logger,optionalContexts,requiredContexts){var configuredContexts=config.context;var contexts=flatMap(configuredContexts,function(context,i){if(optionalContexts[context]){return[optionalContexts[context]];}logger.warn("Invalid context[".concat(i,"]: '").concat(context,"' is not available."));return[];}).concat(requiredContexts);return{namespace:"Context",lifecycle:{onBeforeEvent:function onBeforeEvent(_ref115){var event=_ref115.event;var xdm={};return Promise.all(contexts.map(function(context){return Promise.resolve(context(xdm,logger));})).then(function(){return event.mergeXdm(xdm);});}}};};/* Copyright 2022 Adobe. All rights reserved. This file is licensed to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */var highEntropyUserAgentHints$1=[["architecture","string"],["bitness","string"],["model","string"],["platformVersion","string"],["wow64","boolean"]];/* Copyright 2022 Adobe. All rights reserved. This file is licensed to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */var browserSupportsUserAgentClientHints=function browserSupportsUserAgentClientHints(navigator){return typeof navigator.userAgentData!=="undefined";};var injectHighEntropyUserAgentHints=function injectHighEntropyUserAgentHints(navigator){if(!browserSupportsUserAgentClientHints(navigator)){return noop;}return function(xdm,logger){try{return navigator.userAgentData.getHighEntropyValues(highEntropyUserAgentHints$1.map(function(hint){return hint[0];})).then(function(hints){var userAgentClientHints={};highEntropyUserAgentHints$1.forEach(function(_ref116){var _ref117=_slicedToArray(_ref116,2),hintName=_ref117[0],hintType=_ref117[1];if(Object.prototype.hasOwnProperty.call(hints,hintName)&&/* eslint-disable-next-line valid-typeof */_typeof(hints[hintName])===hintType){userAgentClientHints[hintName]=hints[hintName];}});deepAssign(xdm,{environment:{browserDetails:{userAgentClientHints:userAgentClientHints}}});});}catch(error){logger.warn("Unable to collect user-agent client hints. ".concat(error.message));return noop;}};};/* Copyright 2019 Adobe. All rights reserved. This file is licensed to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */var web=injectWeb(window);var device=injectDevice(window);var environment=injectEnvironment(window);var placeContext=injectPlaceContext(function(){return new Date();});var timestamp=injectTimestamp(function(){return new Date();});var highEntropyUserAgentHints=injectHighEntropyUserAgentHints(navigator);var defaultEnabledContexts={web:web,device:device,environment:environment,placeContext:placeContext};var defaultDisabledContexts={highEntropyUserAgentHints:highEntropyUserAgentHints};var optionalContexts=_objectSpread(_objectSpread({},defaultEnabledContexts),defaultDisabledContexts);var requiredContexts=[timestamp,implementationDetails];var createContext=function createContext(_ref118){var config=_ref118.config,logger=_ref118.logger;return createComponent$2(config,logger,optionalContexts,requiredContexts);};createContext.namespace="Context";createContext.configValidators=boundObjectOf({context:boundArrayOf(boundString())["default"](Object.keys(defaultEnabledContexts))});/* Copyright 2020 Adobe. All rights reserved. This file is licensed to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */var createComponent$1=function createComponent$1(_ref119){var storedConsent=_ref119.storedConsent,taskQueue=_ref119.taskQueue,defaultConsent=_ref119.defaultConsent,consent=_ref119.consent,sendSetConsentRequest=_ref119.sendSetConsentRequest,validateSetConsentOptions=_ref119.validateSetConsentOptions,consentHashStore=_ref119.consentHashStore,doesIdentityCookieExist=_ref119.doesIdentityCookieExist;var defaultConsentByPurpose=_defineProperty({},GENERAL,defaultConsent);var storedConsentByPurpose=storedConsent.read();var identityCookieExists=doesIdentityCookieExist();var consentCookieExists=storedConsentByPurpose[GENERAL]!==undefined;if(!identityCookieExists||!consentCookieExists){consentHashStore.clear();}// If the identity cookie is gone, remove the consent cookie because the // consent info is tied to the identity. if(!identityCookieExists){storedConsent.clear();storedConsentByPurpose={};}consent.initializeConsent(defaultConsentByPurpose,storedConsentByPurpose);var readCookieIfQueueEmpty=function readCookieIfQueueEmpty(){if(taskQueue.length===0){var storedConsentObject=storedConsent.read();// Only read cookies when there are no outstanding setConsent // requests. This helps with race conditions. if(storedConsentObject[GENERAL]!==undefined){consent.setConsent(storedConsentObject);}}};return{commands:{setConsent:{optionsValidator:validateSetConsentOptions,run:function run(_ref120){var consentOptions=_ref120.consent,identityMap=_ref120.identityMap,edgeConfigOverrides=_ref120.edgeConfigOverrides;consent.suspend();var consentHashes=consentHashStore.lookup(consentOptions);return taskQueue.addTask(function(){if(consentHashes.isNew()){return sendSetConsentRequest({consentOptions:consentOptions,identityMap:identityMap,edgeConfigOverrides:edgeConfigOverrides});}return Promise.resolve();}).then(function(){return consentHashes.save();})["finally"](readCookieIfQueueEmpty);}}},lifecycle:{// Read the cookie here too because the consent cookie may change on any request onResponse:readCookieIfQueueEmpty,// Even when we get a failure HTTP status code, the consent cookie can // still get updated. This could happen, for example, if the user is // opted out in AudienceManager, but no consent cookie exists on the // client. The request will be sent and the server will respond with a // 403 Forbidden and a consent cookie. onRequestFailure:readCookieIfQueueEmpty}};};/* Copyright 2020 Adobe. All rights reserved. This file is licensed to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ // serialize an object with a consistent ordering var serialize=function serialize(obj){if(Array.isArray(obj)){return obj.map(function(i){return serialize(i);});}if(_typeof(obj)==="object"&&obj!==null){return Object.keys(obj).sort().reduce(function(memo,key){memo[key]=serialize(obj[key]);return memo;},{});}return obj;};var computeConsentHash=function computeConsentHash(obj){return crc32(JSON.stringify(serialize(obj)));};/* Copyright 2023 Adobe. All rights reserved. This file is licensed to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */var getKey=function getKey(_ref121){var standard=_ref121.standard,version=_ref121.version;return"".concat(standard,".").concat(version);};var createConsentHashStore=function createConsentHashStore(_ref122){var storage=_ref122.storage;return{clear:function clear(){storage.clear();},lookup:function lookup(consentObjects){var currentHashes={};var getCurrentHash=function getCurrentHash(consentObject){var key=getKey(consentObject);var standard=consentObject.standard,version=consentObject.version,rest=_objectWithoutProperties(consentObject,_excluded5);if(!currentHashes[key]){currentHashes[key]=computeConsentHash(rest).toString();}return currentHashes[key];};return{isNew:function isNew(){return consentObjects.some(function(consentObject){var key=getKey(consentObject);var previousHash=storage.getItem(key);return previousHash===null||previousHash!==getCurrentHash(consentObject);});},save:function save(){consentObjects.forEach(function(consentObject){var key=getKey(consentObject);storage.setItem(key,getCurrentHash(consentObject));});}};}};};/* Copyright 2019 Adobe. All rights reserved. This file is licensed to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */var createConsentRequestPayload=function createConsentRequestPayload(){var content={};var payload=createRequestPayload({content:content,addIdentity:function addIdentity(namespaceCode,identity){content.identityMap=content.identityMap||{};content.identityMap[namespaceCode]=content.identityMap[namespaceCode]||[];content.identityMap[namespaceCode].push(identity);},hasIdentity:function hasIdentity(namespaceCode){return(content.identityMap&&content.identityMap[namespaceCode])!==undefined;}});payload.setConsent=function(consent){content.consent=consent;};return payload;};/* Copyright 2020 Adobe. All rights reserved. This file is licensed to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */var createConsentRequest=function createConsentRequest(_ref123){var payload=_ref123.payload,datastreamIdOverride=_ref123.datastreamIdOverride;return createRequest({payload:payload,datastreamIdOverride:datastreamIdOverride,getAction:function getAction(){return"privacy/set-consent";},getUseSendBeacon:function getUseSendBeacon(){return false;}});};/* Copyright 2020 Adobe. All rights reserved. This file is licensed to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */var createStoredConsent=function createStoredConsent(_ref124){var parseConsentCookie=_ref124.parseConsentCookie,orgId=_ref124.orgId,cookieJar=_ref124.cookieJar;var consentCookieName=getNamespacedCookieName(orgId,CONSENT);return{read:function read(){var cookieValue=cookieJar.get(consentCookieName);return cookieValue?parseConsentCookie(cookieValue):{};},clear:function clear(){cookieJar.remove(consentCookieName);}};};/* Copyright 2020 Adobe. All rights reserved. This file is licensed to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */var injectSendSetConsentRequest=function injectSendSetConsentRequest(_ref125){var createConsentRequestPayload=_ref125.createConsentRequestPayload,createConsentRequest=_ref125.createConsentRequest,sendEdgeNetworkRequest=_ref125.sendEdgeNetworkRequest,globalConfigOverrides=_ref125.edgeConfigOverrides;return function(_ref126){var consentOptions=_ref126.consentOptions,identityMap=_ref126.identityMap,localConfigOverrides=_ref126.edgeConfigOverrides;var requestParams=createRequestParams({payload:createConsentRequestPayload(),globalConfigOverrides:globalConfigOverrides,localConfigOverrides:localConfigOverrides});requestParams.payload.setConsent(consentOptions);if(isObject(identityMap)){Object.keys(identityMap).forEach(function(key){identityMap[key].forEach(function(identity){requestParams.payload.addIdentity(key,identity);});});}var request=createConsentRequest(requestParams);return sendEdgeNetworkRequest({request:request}).then(function(){// Don't let response data disseminate beyond this // point unless necessary. });};};/* Copyright 2019 Adobe. All rights reserved. This file is licensed to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ /** * Parses a consent cookie. * @param {string} cookieValue Must be in the format a=b;c=d * @returns {Object} An object where the keys are purpose names and the values * are the consent status for the purpose. */var parseConsentCookie=function parseConsentCookie(cookieValue){var categoryPairs=cookieValue.split(";");return categoryPairs.reduce(function(consentByPurpose,categoryPair){var _categoryPair$split=categoryPair.split("="),_categoryPair$split2=_slicedToArray(_categoryPair$split,2),name=_categoryPair$split2[0],value=_categoryPair$split2[1];consentByPurpose[name]=value;return consentByPurpose;},{});};/* Copyright 2023 Adobe. All rights reserved. This file is licensed to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */var validateSetConsentOptions=boundObjectOf({consent:boundArrayOf(boundAnything()).required().nonEmpty(),identityMap:validateIdentityMap,edgeConfigOverrides:validateConfigOverride}).noUnknownFields().required();/* Copyright 2019 Adobe. All rights reserved. This file is licensed to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */var createPrivacy=function createPrivacy(_ref127){var config=_ref127.config,consent=_ref127.consent,sendEdgeNetworkRequest=_ref127.sendEdgeNetworkRequest,createNamespacedStorage=_ref127.createNamespacedStorage;var orgId=config.orgId,defaultConsent=config.defaultConsent;var storedConsent=createStoredConsent({parseConsentCookie:parseConsentCookie,orgId:orgId,cookieJar:cookieJar});var taskQueue=createTaskQueue();var sendSetConsentRequest=injectSendSetConsentRequest({createConsentRequestPayload:createConsentRequestPayload,createConsentRequest:createConsentRequest,sendEdgeNetworkRequest:sendEdgeNetworkRequest,edgeConfigOverrides:config.edgeConfigOverrides});var storage=createNamespacedStorage("".concat(sanitizeOrgIdForCookieName(orgId),".consentHashes."));var consentHashStore=createConsentHashStore({storage:storage.persistent});var doesIdentityCookieExist=injectDoesIdentityCookieExist({orgId:orgId});return createComponent$1({storedConsent:storedConsent,taskQueue:taskQueue,defaultConsent:defaultConsent,consent:consent,sendSetConsentRequest:sendSetConsentRequest,validateSetConsentOptions:validateSetConsentOptions,consentHashStore:consentHashStore,doesIdentityCookieExist:doesIdentityCookieExist});};createPrivacy.namespace="Privacy";/* Copyright 20219 Adobe. All rights reserved. This file is licensed to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */var createEventMergeId=exports.createEventMergeId=function createEventMergeId(){return{eventMergeId:v4()};};/* Copyright 2020 Adobe. All rights reserved. This file is licensed to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */var createComponent=function createComponent(_ref128){var createEventMergeId=_ref128.createEventMergeId;return{commands:{createEventMergeId:{run:createEventMergeId}}};};/* Copyright 2019 Adobe. All rights reserved. This file is licensed to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */var createEventMerge=function createEventMerge(){return createComponent({createEventMergeId:createEventMergeId});};createEventMerge.namespace="EventMerge";/* Copyright 2019 Adobe. All rights reserved. This file is licensed to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */var prepareLibraryInfo=function prepareLibraryInfo(_ref129){var config=_ref129.config,componentRegistry=_ref129.componentRegistry;var allCommands=[].concat(_toConsumableArray(componentRegistry.getCommandNames()),[CONFIGURE,SET_DEBUG]).sort();var resultConfig=_objectSpread({},config);Object.keys(config).forEach(function(key){var value=config[key];if(typeof value!=="function"){return;}resultConfig[key]=value.toString();});var components=componentRegistry.getComponentNames();return{version:libraryVersion,configs:resultConfig,commands:allCommands,components:components};};var createLibraryInfo=function createLibraryInfo(_ref130){var config=_ref130.config,componentRegistry=_ref130.componentRegistry;var libraryInfo=prepareLibraryInfo({config:config,componentRegistry:componentRegistry});return{commands:{getLibraryInfo:{run:function run(){return{libraryInfo:libraryInfo};}}}};};createLibraryInfo.namespace="LibraryInfo";/* Copyright 2023 Adobe. All rights reserved. This file is licensed to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */var PERSONALIZATION_DECISIONS_HANDLE="personalization:decisions";/* Copyright 2023 Adobe. All rights reserved. This file is licensed to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */var isPlainObject=function isPlainObject(obj){return obj!==null&&_typeof(obj)==="object"&&Object.getPrototypeOf(obj)===Object.prototype;};var flattenObject=function flattenObject(obj){var result=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};var keys=arguments.length>2&&arguments[2]!==undefined?arguments[2]:[];Object.keys(obj).forEach(function(key){if(isPlainObject(obj[key])||Array.isArray(obj[key])){flattenObject(obj[key],result,[].concat(_toConsumableArray(keys),[key]));}else{result[[].concat(_toConsumableArray(keys),[key]).join(".")]=obj[key];}});return result;};var flattenObject$1=function flattenObject$1(obj){if(!isPlainObject(obj)){return obj;}return flattenObject(obj);};/* Copyright 2023 Adobe. All rights reserved. This file is licensed to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */var createOnResponseHandler=function createOnResponseHandler(_ref131){var renderDecisions=_ref131.renderDecisions,decisionProvider=_ref131.decisionProvider,applyResponse=_ref131.applyResponse,event=_ref131.event,personalization=_ref131.personalization,decisionContext=_ref131.decisionContext;var context=_objectSpread(_objectSpread({},flattenObject$1(event.getContent())),decisionContext);return function(_ref132){var response=_ref132.response;decisionProvider.addPayloads(response.getPayloadsByType(PERSONALIZATION_DECISIONS_HANDLE));// only evaluate events that include a personalization query if(!event.hasQuery()){return{propositions:[]};}var propositions=decisionProvider.evaluate(context);return applyResponse({renderDecisions:renderDecisions,propositions:propositions,event:event,personalization:personalization});};};var ConditionType={MATCHER:"matcher",GROUP:"group",HISTORICAL:"historical"};var MatcherType={EQUALS:"eq",NOT_EQUALS:"ne",EXISTS:"ex",NOT_EXISTS:"nx",GREATER_THAN:"gt",GREATER_THAN_OR_EQUAL_TO:"ge",LESS_THAN:"lt",LESS_THAN_OR_EQUAL_TO:"le",CONTAINS:"co",NOT_CONTAINS:"nc",STARTS_WITH:"sw",ENDS_WITH:"ew"};var LogicType={AND:"and",OR:"or"};var SearchType={ANY:"any",ORDERED:"ordered"};function isObjectOrUndefined(value){return _typeof(value)==="object"||typeof value==="undefined";}function createEquals(){return{matches:function matches(context,key){var values=arguments.length>2&&arguments[2]!==undefined?arguments[2]:[];if(isObjectOrUndefined(context[key])){return false;}var contextValue=String(context[key]).toLowerCase();for(var _i16=0;_i162&&arguments[2]!==undefined?arguments[2]:[];if(isObjectOrUndefined(context[key])){return false;}var contextValue=String(context[key]).toLowerCase();for(var _i17=0;_i172&&arguments[2]!==undefined?arguments[2]:[];var needle=context[key];if(!isNumber(needle)){return false;}for(var _i18=0;_i18values[_i18]){return true;}}return false;}};}function createGreaterThanEquals(){return{matches:function matches(context,key){var values=arguments.length>2&&arguments[2]!==undefined?arguments[2]:[];var needle=context[key];if(!isNumber(needle)){return false;}for(var _i19=0;_i19=values[_i19]){return true;}}return false;}};}function createLessThan(){return{matches:function matches(context,key){var values=arguments.length>2&&arguments[2]!==undefined?arguments[2]:[];var needle=context[key];if(!isNumber(needle)){return false;}for(var _i20=0;_i202&&arguments[2]!==undefined?arguments[2]:[];var needle=context[key];if(!isNumber(needle)){return false;}for(var _i21=0;_i212&&arguments[2]!==undefined?arguments[2]:[];if(isObjectOrUndefined(context[key])){return false;}var contextValue=String(context[key]).toLowerCase();for(var _i22=0;_i222&&arguments[2]!==undefined?arguments[2]:[];if(isObjectOrUndefined(context[key])){return false;}var contextValue=String(context[key]).toLowerCase();for(var _i23=0;_i232&&arguments[2]!==undefined?arguments[2]:[];if(isObjectOrUndefined(context[key])){return false;}var contextValue=String(context[key]).toLowerCase();for(var _i24=0;_i242&&arguments[2]!==undefined?arguments[2]:[];if(isObjectOrUndefined(context[key])){return false;}var contextValue=String(context[key]).toLowerCase();for(var _i25=0;_i25value;case MatcherType.GREATER_THAN_OR_EQUAL_TO:return eventCount>=value;case MatcherType.LESS_THAN:return eventCount=from&&contextEvent.timestamp<=to){return countTotal+eventCount;}return countTotal;},0);}function queryAndCountOrderedEvent(events,context,from,to){var previousEventTimestamp=from;var sameSequence=events.every(function(event){var eventType=oneOf(event,VALID_EVENT_TYPES);if(!eventType){return false;}var eventsOfType=context.events[eventType];if(!eventsOfType){return false;}var eventId=oneOf(event,VALID_EVENT_IDS);if(!eventId){return false;}var contextEvent=eventsOfType[eventId];if(!eventSatisfiesCondition(event,contextEvent)){return false;}if(contextEvent===null||isUndefined(contextEvent)||contextEvent.count===0){return false;}var ordered=(isUndefined(previousEventTimestamp)||contextEvent.timestamp>=previousEventTimestamp)&&(isUndefined(to)||contextEvent.timestamp<=to);previousEventTimestamp=contextEvent.timestamp;return ordered;});return sameSequence?1:0;}function evaluateAnd(context,conditions){var result=true;for(var _i28=0;_i280;});},getVersion:function getVersion(){return version;},numRules:function numRules(){return rules.length;}};}/* Copyright 2023 Adobe. All rights reserved. This file is licensed to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */var createRestoreStorage=function createRestoreStorage(storage,storageKey){return function(defaultValue){var stored=storage.getItem(storageKey);if(!stored){return defaultValue;}try{return JSON.parse(stored);}catch(e){return defaultValue;}};};var createSaveStorage=function createSaveStorage(storage,storageKey){var prepareFn=arguments.length>2&&arguments[2]!==undefined?arguments[2]:function(value){return value;};return function(value){storage.setItem(storageKey,JSON.stringify(prepareFn(value)));};};var getExpirationDate=function getExpirationDate(retentionPeriod){var expirationDate=new Date();expirationDate.setDate(expirationDate.getDate()-retentionPeriod);return expirationDate;};var getActivityId=function getActivityId(proposition){var _proposition$scopeDet=proposition.scopeDetails,scopeDetails=_proposition$scopeDet===void 0?{}:_proposition$scopeDet;var _scopeDetails$activit=scopeDetails.activity,activity=_scopeDetails$activit===void 0?{}:_scopeDetails$activit;var id=activity.id;return id;};var createInMemoryStorage=function createInMemoryStorage(){var inMemoryStorage={};return{getItem:function getItem(key){return key in inMemoryStorage?inMemoryStorage[key]:null;},setItem:function setItem(key,value){inMemoryStorage[key]=value;}};};var clearLocalStorage=function clearLocalStorage(storage){storage.clear();};var hasExperienceData=function hasExperienceData(xdm){var _xdm$eventType=xdm.eventType,eventType=_xdm$eventType===void 0?"":_xdm$eventType,_experience=xdm._experience;if(!eventType||eventType===""){return false;}if(!_experience||_typeof(_experience)!=="object"){return false;}return true;};var getDecisionProvider=function getDecisionProvider(proposition){var _proposition$scopeDet2=proposition.scopeDetails,scopeDetails=_proposition$scopeDet2===void 0?{}:_proposition$scopeDet2;var decisionProvider=scopeDetails.decisionProvider;return decisionProvider;};/* Copyright 2023 Adobe. All rights reserved. This file is licensed to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */var flattenArray=function flattenArray(){var items=arguments.length>0&&arguments[0]!==undefined?arguments[0]:[];var flat=[];if(!Array.isArray(items)){return items;}items.forEach(function(item){if(Array.isArray(item)){flat.push.apply(flat,_toConsumableArray(flattenArray(item)));}else{flat.push(item);}});return flat;};/* Copyright 2023 Adobe. All rights reserved. This file is licensed to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */var inAppMessageConsequenceAdapter=function inAppMessageConsequenceAdapter(id,type,detail){var html=detail.html,mobileParameters=detail.mobileParameters;var webParameters={};return{schema:MESSAGE_IN_APP,data:{mobileParameters:mobileParameters,webParameters:webParameters,content:html,contentType:TEXT_HTML},id:id};};/* Copyright 2023 Adobe. All rights reserved. This file is licensed to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */var schemaTypeConsequenceAdapter=function schemaTypeConsequenceAdapter(id,type,detail){var schema=detail.schema,data=detail.data,detailId=detail.id;return{schema:schema,data:data,id:detailId||id};};/* Copyright 2023 Adobe. All rights reserved. This file is licensed to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */var CJM_IN_APP_MESSAGE_TYPE="cjmiam";var SCHEMA="schema";var adapters=_defineProperty(_defineProperty({},CJM_IN_APP_MESSAGE_TYPE,inAppMessageConsequenceAdapter),SCHEMA,schemaTypeConsequenceAdapter);var createConsequenceAdapter=function createConsequenceAdapter(){return function(consequence){var id=consequence.id,type=consequence.type,detail=consequence.detail;return typeof adapters[type]==="function"?adapters[type](id,type,detail):detail;};};/* Copyright 2023 Adobe. All rights reserved. This file is licensed to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */var isRulesetItem=function isRulesetItem(item){var schema=item.schema,data=item.data;if(schema===RULESET_ITEM){return true;}if(schema!==JSON_CONTENT_ITEM){return false;}try{var content=typeof data.content==="string"?JSON.parse(data.content):data.content;return content&&Object.prototype.hasOwnProperty.call(content,"version")&&Object.prototype.hasOwnProperty.call(content,"rules");}catch(error){return false;}};var createEvaluableRulesetPayload=function createEvaluableRulesetPayload(payload,eventRegistry,decisionHistory){var consequenceAdapter=createConsequenceAdapter();var activityId=getActivityId(payload);var items=[];var addItem=function addItem(item){var _item$data=item.data,data=_item$data===void 0?{}:_item$data,schema=item.schema;var content=schema===RULESET_ITEM?data:data.content;if(!content){return;}items.push(RulesEngine(typeof content==="string"?JSON.parse(content):content));};var evaluate=function evaluate(context){var displayEvent=eventRegistry.getEvent(DISPLAY,activityId);var displayedDate=displayEvent?displayEvent.firstTimestamp:undefined;var qualifyingItems=flattenArray(items.map(function(item){return item.execute(context);})).map(consequenceAdapter).map(function(item){var _ref133=decisionHistory.recordQualified(activityId)||{},qualifiedDate=_ref133.firstTimestamp;return _objectSpread(_objectSpread({},item),{},{data:_objectSpread(_objectSpread({},item.data),{},{qualifiedDate:qualifiedDate,displayedDate:displayedDate})});});return _objectSpread(_objectSpread({},payload),{},{items:qualifyingItems});};if(Array.isArray(payload.items)){payload.items.filter(isRulesetItem).forEach(addItem);}return{evaluate:evaluate,isEvaluable:items.length>0};};/* Copyright 2023 Adobe. All rights reserved. This file is licensed to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */var createDecisionHistory=function createDecisionHistory(_ref134){var eventRegistry=_ref134.eventRegistry;var recordQualified=function recordQualified(id){if(!id){return undefined;}return eventRegistry.addEvent({},PropositionEventType.TRIGGER,id);};return{recordQualified:recordQualified};};/* Copyright 2023 Adobe. All rights reserved. This file is licensed to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */var createDecisionProvider=function createDecisionProvider(_ref135){var eventRegistry=_ref135.eventRegistry;var payloadsBasedOnActivityId={};var decisionHistory=createDecisionHistory({eventRegistry:eventRegistry});var addPayload=function addPayload(payload){var activityId=getActivityId(payload);if(!activityId){return;}var evaluableRulesetPayload=createEvaluableRulesetPayload(payload,eventRegistry,decisionHistory);if(evaluableRulesetPayload.isEvaluable){payloadsBasedOnActivityId[activityId]=evaluableRulesetPayload;}};var evaluate=function evaluate(){var context=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};return Object.values(payloadsBasedOnActivityId).map(function(payload){return payload.evaluate(context);}).filter(function(payload){return payload.items.length>0;});};var addPayloads=function addPayloads(personalizationPayloads){personalizationPayloads.forEach(addPayload);};return{addPayload:addPayload,addPayloads:addPayloads,evaluate:evaluate};};/* Copyright 2023 Adobe. All rights reserved. This file is licensed to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */var createApplyResponse=function createApplyResponse(lifecycle){return function(_ref136){var _ref136$renderDecisio=_ref136.renderDecisions,renderDecisions=_ref136$renderDecisio===void 0?false:_ref136$renderDecisio,_ref136$propositions=_ref136.propositions,propositions=_ref136$propositions===void 0?[]:_ref136$propositions,event=_ref136.event,personalization=_ref136.personalization;if(propositions.length>0&&lifecycle){lifecycle.onDecision({renderDecisions:renderDecisions,propositions:propositions,event:event,personalization:personalization});}return{propositions:propositions};};};/* Copyright 2023 Adobe. All rights reserved. This file is licensed to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */var STORAGE_KEY="events";var MAX_EVENT_RECORDS=1000;var RETENTION_PERIOD=30;var prefixed=function prefixed(key){return"iam.".concat(key);};var createEventPruner=function createEventPruner(){var limit=arguments.length>0&&arguments[0]!==undefined?arguments[0]:MAX_EVENT_RECORDS;var retentionPeriod=arguments.length>1&&arguments[1]!==undefined?arguments[1]:RETENTION_PERIOD;return function(events){var pruned={};Object.keys(events).forEach(function(eventType){pruned[eventType]={};Object.values(events[eventType]).filter(function(entry){return new Date(entry.firstTimestamp)>=getExpirationDate(retentionPeriod);}).sort(function(a,b){return a.firstTimestamp-b.firstTimestamp;}).slice(-1*limit).forEach(function(entry){pruned[eventType][entry.event[prefixed("id")]]=entry;});});return pruned;};};var createEventRegistry=function createEventRegistry(_ref137){var storage=_ref137.storage;var currentStorage=storage;var restore;var save;var events;var setStorage=function setStorage(newStorage){currentStorage=newStorage;restore=createRestoreStorage(currentStorage,STORAGE_KEY);save=createSaveStorage(currentStorage,STORAGE_KEY,createEventPruner(MAX_EVENT_RECORDS,RETENTION_PERIOD));events=restore({});};setStorage(storage);var addEvent=function addEvent(event,eventType,eventId,action){if(!eventType||!eventId){return undefined;}if(!events[eventType]){events[eventType]={};}var existingEvent=events[eventType][eventId];var count=existingEvent?existingEvent.count:0;var timestamp=new Date().getTime();var firstTimestamp=existingEvent?existingEvent.firstTimestamp||existingEvent.timestamp:timestamp;events[eventType][eventId]={event:_objectSpread(_objectSpread({},event),{},_defineProperty(_defineProperty(_defineProperty({},prefixed("id"),eventId),prefixed("eventType"),eventType),prefixed("action"),action)),firstTimestamp:firstTimestamp,timestamp:timestamp,count:count+1};save(events);return events[eventType][eventId];};var addExperienceEdgeEvent=function addExperienceEdgeEvent(event){var _event$getContent=event.getContent(),_event$getContent$xdm=_event$getContent.xdm,xdm=_event$getContent$xdm===void 0?{}:_event$getContent$xdm;var _experience=xdm._experience;if(!hasExperienceData(xdm)){return;}var _experience$decisioni=_experience.decisioning,decisioning=_experience$decisioni===void 0?{}:_experience$decisioni;var _decisioning$proposit=decisioning.propositionEventType,propositionEventTypeObj=_decisioning$proposit===void 0?{}:_decisioning$proposit,_decisioning$proposit2=decisioning.propositionAction,propositionAction=_decisioning$proposit2===void 0?{}:_decisioning$proposit2,_decisioning$proposit3=decisioning.propositions,propositions=_decisioning$proposit3===void 0?[]:_decisioning$proposit3;var propositionEventTypesList=Object.keys(propositionEventTypeObj);// https://wiki.corp.adobe.com/pages/viewpage.action?spaceKey=CJM&title=Proposition+Event+Types if(propositionEventTypesList.length===0){return;}var validPropositionEventType=function validPropositionEventType(propositionEventType){return propositionEventTypeObj[propositionEventType]===EVENT_TYPE_TRUE;};var action=propositionAction.id;propositionEventTypesList.filter(validPropositionEventType).forEach(function(propositionEventType){propositions.forEach(function(proposition){if(getDecisionProvider(proposition)!==ADOBE_JOURNEY_OPTIMIZER){return;}addEvent({},propositionEventType,getActivityId(proposition),action);});});};var getEvent=function getEvent(eventType,eventId){if(!events[eventType]){return undefined;}return events[eventType][eventId];};return{addExperienceEdgeEvent:addExperienceEdgeEvent,addEvent:addEvent,getEvent:getEvent,toJSON:function toJSON(){return events;},setStorage:setStorage};};/* Copyright 2023 Adobe. All rights reserved. This file is licensed to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */var createContextProvider=function createContextProvider(_ref138){var eventRegistry=_ref138.eventRegistry,window=_ref138.window;var pageLoadTimestamp=new Date().getTime();var getBrowserContext=function getBrowserContext(){return{name:getBrowser(window)};};var getPageContext=function getPageContext(){return _objectSpread({title:window.title,url:window.url},parseUrl(window.url));};var getReferrerContext=function getReferrerContext(){return _objectSpread({url:window.referrer},parseUrl(window.referrer));};var getTimeContext=function getTimeContext(){var now=new Date();var currentTimestamp=now.getTime();return{pageLoadTimestamp:pageLoadTimestamp,currentTimestamp:currentTimestamp,currentDate:now.getDate(),// Day of the week starts on Monday as is practiced in ISO 8601, but we want it to start on Sunday to match the authoring UI rule "~state.com.adobe.module.lifecycle/lifecyclecontextdata.dayofweek":now.getDay()+1,"~state.com.adobe.module.lifecycle/lifecyclecontextdata.hourofday":now.getHours(),currentMinute:now.getMinutes(),currentMonth:now.getMonth(),currentYear:now.getFullYear(),pageVisitDuration:currentTimestamp-pageLoadTimestamp,"~timestampu":currentTimestamp/1000,"~timestampz":now.toISOString()};};var getWindowContext=function getWindowContext(){var height=window.height;var width=window.width;var scrollY=window.scrollY;var scrollX=window.scrollX;return{height:height,width:width,scrollY:scrollY,scrollX:scrollX};};var coreGlobalContext={browser:getBrowserContext(),page:getPageContext(),referringPage:getReferrerContext()};var getGlobalContext=function getGlobalContext(){return _objectSpread(_objectSpread(_objectSpread({},coreGlobalContext),getTimeContext()),{},{window:getWindowContext(),"~sdkver":libraryVersion});};var getContext=function getContext(){var addedContext=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};var context=_objectSpread(_objectSpread({},getGlobalContext()),addedContext);return _objectSpread(_objectSpread({},flattenObject$1(context)),{},{events:eventRegistry.toJSON()});};return{getContext:getContext};};/* Copyright 2023 Adobe. All rights reserved. This file is licensed to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */var defaultPreprocessor=function defaultPreprocessor(params){for(var _len7=arguments.length,args=new Array(_len7>1?_len7-1:0),_key7=1;_key7<_len7;_key7++){args[_key7-1]=arguments[_key7];}return args;};// eslint-disable-next-line no-unused-vars var defaultEmissionCondition=function defaultEmissionCondition(params){return true;};var createSubscription=function createSubscription(){var preprocessor=defaultPreprocessor;var emissionCondition=defaultEmissionCondition;var counter=0;var subscriptions={};var createUnsubscribe=function createUnsubscribe(id){return function(){delete subscriptions[id];};};var add=function add(callback){var params=arguments.length>1&&arguments[1]!==undefined?arguments[1]:undefined;if(typeof callback!=="function"){return function(){return undefined;};}counter+=1;subscriptions[counter]={callback:callback,params:params};return createUnsubscribe(counter);};var setEmissionPreprocessor=function setEmissionPreprocessor(value){if(typeof value==="function"){preprocessor=value;}};var setEmissionCondition=function setEmissionCondition(value){if(typeof value==="function"){emissionCondition=value;}};var emit=function emit(){for(var _len8=arguments.length,args=new Array(_len8),_key8=0;_key8<_len8;_key8++){args[_key8]=arguments[_key8];}values(subscriptions).forEach(function(_ref139){var callback=_ref139.callback,params=_ref139.params;var result=preprocessor.apply(void 0,[params].concat(args));if(emissionCondition.apply(void 0,[params].concat(_toConsumableArray(result)))){callback.apply(void 0,_toConsumableArray(result));}});};var hasSubscriptions=function hasSubscriptions(){return Object.keys(subscriptions).length>0;};return{add:add,emit:emit,hasSubscriptions:hasSubscriptions,setEmissionPreprocessor:setEmissionPreprocessor,setEmissionCondition:setEmissionCondition};};/* Copyright 2023 Adobe. All rights reserved. This file is licensed to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */var validateOptions$1=function validateOptions$1(_ref140){var options=_ref140.options;var validator=boundObjectOf({surfaces:boundArrayOf(boundString()).uniqueItems(),schemas:boundArrayOf(boundString()).uniqueItems(),callback:boundCallback().required()}).noUnknownFields();return validator(options);};var emissionPreprocessor=function emissionPreprocessor(params,propositions){var surfacesFilter=params.surfacesFilter,schemasFilter=params.schemasFilter;var result={propositions:propositions.filter(function(payload){return surfacesFilter?includes(surfacesFilter,payload.scope):true;}).map(function(payload){var _payload$items2=payload.items,items=_payload$items2===void 0?[]:_payload$items2;return _objectSpread(_objectSpread({},payload),{},{items:items.filter(function(item){return schemasFilter?includes(schemasFilter,item.schema):true;})});}).filter(function(payload){return payload.items.length>0;})};return[result];};var emissionCondition=function emissionCondition(params,result){return result.propositions.length>0;};var createSubscribeRulesetItems=function createSubscribeRulesetItems(){var subscription=createSubscription();subscription.setEmissionPreprocessor(emissionPreprocessor);subscription.setEmissionCondition(emissionCondition);var run=function run(_ref141){var surfaces=_ref141.surfaces,schemas=_ref141.schemas,callback=_ref141.callback;var unsubscribe=subscription.add(callback,{surfacesFilter:surfaces instanceof Array?surfaces:undefined,schemasFilter:schemas instanceof Array?schemas:undefined});return Promise.resolve({unsubscribe:unsubscribe});};var optionsValidator=function optionsValidator(options){return validateOptions$1({options:options});};var refresh=function refresh(propositions){if(!subscription.hasSubscriptions()){return;}subscription.emit(propositions);};return{refresh:refresh,command:{optionsValidator:optionsValidator,run:run}};};/* Copyright 2023 Adobe. All rights reserved. This file is licensed to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */var CONTEXT_KEY={TYPE:"~type",SOURCE:"~source"};var CONTEXT_EVENT_TYPE={LIFECYCLE:"com.adobe.eventType.lifecycle",TRACK:"com.adobe.eventType.generic.track",EDGE:"com.adobe.eventType.edge",RULES_ENGINE:"com.adobe.eventType.rulesEngine"};var CONTEXT_EVENT_SOURCE={LAUNCH:"com.adobe.eventSource.applicationLaunch",REQUEST:"com.adobe.eventSource.requestContent"};/* Copyright 2023 Adobe. All rights reserved. This file is licensed to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */var validateOptions=function validateOptions(_ref142){var options=_ref142.options;var validator=boundObjectOf({renderDecisions:boundBoolean(),personalization:boundObjectOf({decisionContext:boundObjectOf({})})}).noUnknownFields();return validator(options);};var createEvaluateRulesetsCommand=function createEvaluateRulesetsCommand(_ref143){var contextProvider=_ref143.contextProvider,decisionProvider=_ref143.decisionProvider;var run=function run(_ref144){var renderDecisions=_ref144.renderDecisions,decisionContext=_ref144.decisionContext,applyResponse=_ref144.applyResponse;return applyResponse({renderDecisions:renderDecisions,propositions:decisionProvider.evaluate(contextProvider.getContext(decisionContext))});};var optionsValidator=function optionsValidator(options){return validateOptions({options:options});};return{optionsValidator:optionsValidator,run:run};};/* Copyright 2023 Adobe. All rights reserved. This file is licensed to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */var createDecisioningEngine=function createDecisioningEngine(_ref145){var config=_ref145.config,createNamespacedStorage=_ref145.createNamespacedStorage,consent=_ref145.consent;var orgId=config.orgId,personalizationStorageEnabled=config.personalizationStorageEnabled;var storage=createNamespacedStorage("".concat(sanitizeOrgIdForCookieName(orgId),".decisioning."));if(!personalizationStorageEnabled){clearLocalStorage(storage.persistent);}var eventRegistry=createEventRegistry({storage:createInMemoryStorage()});var decisionProvider=createDecisionProvider({eventRegistry:eventRegistry});var contextProvider=createContextProvider({eventRegistry:eventRegistry,window:window});var evaluateRulesetsCommand=createEvaluateRulesetsCommand({contextProvider:contextProvider,decisionProvider:decisionProvider});var subscribeRulesetItems=createSubscribeRulesetItems();var applyResponse;return{lifecycle:{onDecision:function onDecision(_ref146){var propositions=_ref146.propositions;subscribeRulesetItems.refresh(propositions);},onComponentsRegistered:function onComponentsRegistered(tools){applyResponse=createApplyResponse(tools.lifecycle);if(personalizationStorageEnabled){consent.awaitConsent().then(function(){eventRegistry.setStorage(storage.persistent);})["catch"](function(){if(storage){clearLocalStorage(storage.persistent);}});}},onBeforeEvent:function onBeforeEvent(_ref147){var event=_ref147.event,renderDecisions=_ref147.renderDecisions,_ref147$personalizati=_ref147.personalization,personalization=_ref147$personalizati===void 0?{}:_ref147$personalizati,_ref147$onResponse=_ref147.onResponse,onResponse=_ref147$onResponse===void 0?noop:_ref147$onResponse;var _personalization$deci=personalization.decisionContext,decisionContext=_personalization$deci===void 0?{}:_personalization$deci;onResponse(createOnResponseHandler({renderDecisions:renderDecisions,decisionProvider:decisionProvider,applyResponse:applyResponse,event:event,personalization:personalization,decisionContext:contextProvider.getContext(_objectSpread(_defineProperty(_defineProperty({},CONTEXT_KEY.TYPE,CONTEXT_EVENT_TYPE.EDGE),CONTEXT_KEY.SOURCE,CONTEXT_EVENT_SOURCE.REQUEST),decisionContext))}));eventRegistry.addExperienceEdgeEvent(event);}},commands:{evaluateRulesets:{run:function run(_ref148){var renderDecisions=_ref148.renderDecisions,_ref148$personalizati=_ref148.personalization,personalization=_ref148$personalizati===void 0?{}:_ref148$personalizati;var _personalization$deci2=personalization.decisionContext,decisionContext=_personalization$deci2===void 0?{}:_personalization$deci2;return evaluateRulesetsCommand.run({renderDecisions:renderDecisions,decisionContext:_objectSpread(_defineProperty(_defineProperty({},CONTEXT_KEY.TYPE,CONTEXT_EVENT_TYPE.RULES_ENGINE),CONTEXT_KEY.SOURCE,CONTEXT_EVENT_SOURCE.REQUEST),decisionContext),applyResponse:applyResponse});},optionsValidator:evaluateRulesetsCommand.optionsValidator},subscribeRulesetItems:subscribeRulesetItems.command}};};createDecisioningEngine.namespace="DecisioningEngine";createDecisioningEngine.configValidators=boundObjectOf({personalizationStorageEnabled:boundBoolean()["default"](false)});/* Copyright 2021 Adobe. All rights reserved. This file is licensed to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */var processResponse=function processResponse(_ref149){var response=_ref149.response;return{inferences:response.getPayloadsByType("rtml:inferences")};};/* Copyright 2021 Adobe. All rights reserved. This file is licensed to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */var createMachineLearning=function createMachineLearning(){return{lifecycle:{onResponse:processResponse},commands:{}};};createMachineLearning.namespace="MachineLearning";/* Copyright 2024 Adobe. All rights reserved. This file is licensed to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */var PlaybackState={MAIN:"main",AD:"ad",COMPLETED:"completed"};/* Copyright 2023 Adobe. All rights reserved. This file is licensed to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */var createMediaSessionCacheManager=function createMediaSessionCacheManager(){var mediaSessionCache;var getSession=function getSession(playerId){return mediaSessionCache[playerId]||{};};var savePing=function savePing(_ref150){var playerId=_ref150.playerId,pingId=_ref150.pingId,playbackState=_ref150.playbackState;if(!mediaSessionCache[playerId]){return;}if(mediaSessionCache[playerId].pingId){clearTimeout(mediaSessionCache[playerId].pingId);}mediaSessionCache[playerId].pingId=pingId;mediaSessionCache[playerId].playbackState=playbackState;};var stopPing=function stopPing(_ref151){var playerId=_ref151.playerId;var sessionDetails=mediaSessionCache[playerId];if(!sessionDetails){return;}clearTimeout(sessionDetails.pingId);sessionDetails.pingId=null;sessionDetails.playbackState=PlaybackState.COMPLETED;};var storeSession=function storeSession(_ref152){var playerId=_ref152.playerId,sessionDetails=_ref152.sessionDetails;if(mediaSessionCache===undefined){mediaSessionCache={};}mediaSessionCache[playerId]=sessionDetails;};return{getSession:getSession,storeSession:storeSession,stopPing:stopPing,savePing:savePing};};/* Copyright 2023 Adobe. All rights reserved. This file is licensed to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */var MediaEvents={PAUSE:"media.pauseStart",PLAY:"media.play",BUFFER_START:"media.bufferStart",AD_START:"media.adStart",Ad_BREAK_START:"media.adBreakStart",SESSION_END:"media.sessionEnd",SESSION_START:"media.sessionStart",SESSION_COMPLETE:"media.sessionComplete",PING:"media.ping",AD_BREAK_COMPLETE:"media.adBreakComplete",AD_COMPLETE:"media.adComplete",AD_SKIP:"media.adSkip",BITRATE_CHANGE:"media.bitrateChange",CHAPTER_COMPLETE:"media.chapterComplete",CHAPTER_SKIP:"media.chapterSkip",CHAPTER_START:"media.chapterStart",ERROR:"media.error",STATES_UPDATE:"media.statesUpdate"};/* Copyright 2023 Adobe. All rights reserved. This file is licensed to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */var createMediaRequest=function createMediaRequest(_ref153){var mediaRequestPayload=_ref153.mediaRequestPayload,action=_ref153.action;return createRequest({payload:mediaRequestPayload,edgeSubPath:"/va",getAction:function getAction(){return action;},getUseSendBeacon:function getUseSendBeacon(){return false;}});};/* Copyright 2023 Adobe. All rights reserved. This file is licensed to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */var createMediaEventManager=function createMediaEventManager(_ref154){var config=_ref154.config,eventManager=_ref154.eventManager,consent=_ref154.consent,sendEdgeNetworkRequest=_ref154.sendEdgeNetworkRequest,setTimestamp=_ref154.setTimestamp;return{createMediaEvent:function createMediaEvent(_ref155){var options=_ref155.options;var event=eventManager.createEvent();var xdm=options.xdm;setTimestamp(xdm);event.setUserXdm(xdm);if(xdm.eventType===MediaEvents.AD_START){var advertisingDetails=options.xdm.mediaCollection.advertisingDetails;event.mergeXdm({mediaCollection:{advertisingDetails:{playerName:advertisingDetails.playerName||config.streamingMedia.playerName}}});}return event;},createMediaSession:function createMediaSession(options){var _config$streamingMedi=config.streamingMedia,playerName=_config$streamingMedi.playerName,channel=_config$streamingMedi.channel,appVersion=_config$streamingMedi.appVersion;var event=eventManager.createEvent();var sessionDetails=options.xdm.mediaCollection.sessionDetails;event.setUserXdm(options.xdm);event.mergeXdm({eventType:MediaEvents.SESSION_START,mediaCollection:{sessionDetails:{playerName:sessionDetails.playerName||playerName,channel:sessionDetails.channel||channel,appVersion:sessionDetails.appVersion||appVersion}}});return event;},augmentMediaEvent:function augmentMediaEvent(_ref156){var event=_ref156.event,playerId=_ref156.playerId,getPlayerDetails=_ref156.getPlayerDetails,sessionID=_ref156.sessionID;if(!playerId||!getPlayerDetails){return event;}var _getPlayerDetails=getPlayerDetails({playerId:playerId}),playhead=_getPlayerDetails.playhead,qoeDataDetails=_getPlayerDetails.qoeDataDetails;event.mergeXdm({mediaCollection:{playhead:toInteger(playhead),qoeDataDetails:qoeDataDetails,sessionID:sessionID}});return event;},trackMediaSession:function trackMediaSession(_ref157){var event=_ref157.event,mediaOptions=_ref157.mediaOptions;return eventManager.sendEvent(event,{mediaOptions:mediaOptions});},trackMediaEvent:function trackMediaEvent(_ref158){var event=_ref158.event,action=_ref158.action;var mediaRequestPayload=createDataCollectionRequestPayload();var request=createMediaRequest({mediaRequestPayload:mediaRequestPayload,action:action});mediaRequestPayload.addEvent(event);event.finalize();return consent.awaitConsent().then(function(){return sendEdgeNetworkRequest({request:request}).then(function(){return{};});});}};};/* Copyright 2024 Adobe. All rights reserved. This file is licensed to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */var getContentState=function getContentState(eventType,sessionContentState){if(eventType===MediaEvents.AD_START||eventType===MediaEvents.Ad_BREAK_START||eventType===MediaEvents.AD_SKIP||eventType===MediaEvents.AD_COMPLETE){return"ad";}if(eventType===MediaEvents.AD_BREAK_COMPLETE||eventType===MediaEvents.CHAPTER_COMPLETE||eventType===MediaEvents.CHAPTER_START||eventType===MediaEvents.CHAPTER_SKIP||eventType===MediaEvents.SESSION_START){return"main";}if(eventType===MediaEvents.SESSION_END||eventType===MediaEvents.SESSION_COMPLETE){return"completed";}return sessionContentState;};var createTrackMediaEvent=function createTrackMediaEvent(_ref159){var mediaEventManager=_ref159.mediaEventManager,mediaSessionCacheManager=_ref159.mediaSessionCacheManager,config=_ref159.config;var sendMediaEvent=function sendMediaEvent(options){var event=mediaEventManager.createMediaEvent({options:options});var playerId=options.playerId,xdm=options.xdm;var eventType=xdm.eventType;var action=eventType.split(".")[1];var _mediaSessionCacheMan=mediaSessionCacheManager.getSession(playerId),getPlayerDetails=_mediaSessionCacheMan.getPlayerDetails,sessionPromise=_mediaSessionCacheMan.sessionPromise,playbackState=_mediaSessionCacheMan.playbackState;return sessionPromise.then(function(result){if(!result.sessionId){return Promise.reject(new Error("Failed to trigger media event: ".concat(eventType,". Session ID is not available for playerId: ").concat(playerId,".")));}mediaEventManager.augmentMediaEvent({event:event,eventType:eventType,playerId:playerId,getPlayerDetails:getPlayerDetails,sessionID:result.sessionId});return mediaEventManager.trackMediaEvent({event:event,action:action}).then(function(){if(playerId){if(eventType===MediaEvents.SESSION_COMPLETE||eventType===MediaEvents.SESSION_END){mediaSessionCacheManager.stopPing({playerId:playerId});}else{var sessionPlaybackState=getContentState(eventType,playbackState);if(sessionPlaybackState==="completed"){return;}var interval=sessionPlaybackState==="ad"?config.streamingMedia.adPingInterval:config.streamingMedia.mainPingInterval;var pingId=setTimeout(function(){var pingOptions={playerId:playerId,xdm:{eventType:MediaEvents.PING}};sendMediaEvent(pingOptions);},interval*1000);mediaSessionCacheManager.savePing({playerId:playerId,pingId:pingId,playbackState:sessionPlaybackState});}}});});};return function(options){return sendMediaEvent(options);};};/* Copyright 2024 Adobe. All rights reserved. This file is licensed to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */var configValidators=boundObjectOf({streamingMedia:boundObjectOf({channel:boundString().nonEmpty().required(),playerName:boundString().nonEmpty().required(),appVersion:boundString(),mainPingInterval:boundNumber().minimum(10).maximum(50)["default"](10),adPingInterval:boundNumber().minimum(1).maximum(10)["default"](10)}).noUnknownFields()});/* Copyright 2023 Adobe. All rights reserved. This file is licensed to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */var validateSessionOptions=function validateSessionOptions(_ref160){var options=_ref160.options;var sessionValidator=boundAnyOf([boundObjectOf({playerId:boundString().required(),getPlayerDetails:boundCallback().required(),xdm:boundObjectOf({mediaCollection:boundObjectOf({sessionDetails:boundObjectOf(boundAnything()).required()})})}).required(),boundObjectOf({xdm:boundObjectOf({mediaCollection:boundObjectOf({playhead:boundNumber().required(),sessionDetails:boundObjectOf(boundAnything()).required()})})}).required()],"Error validating the createMediaSession command options.");return sessionValidator(options);};/* Copyright 2023 Adobe. All rights reserved. This file is licensed to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */var validateMediaEventOptions=function validateMediaEventOptions(_ref161){var options=_ref161.options;var validator=boundAnyOf([boundObjectOf({playerId:boundString().required(),xdm:boundObjectOf({eventType:boundEnumOf.apply(void 0,_toConsumableArray(Object.values(MediaEvents))).required(),mediaCollection:boundObjectOf(boundAnything())}).required()}).required(),boundObjectOf({xdm:boundObjectOf({eventType:boundEnumOf.apply(void 0,_toConsumableArray(Object.values(MediaEvents))).required(),mediaCollection:boundObjectOf({playhead:boundNumber().integer().required(),sessionID:boundString().required()}).required()}).required()}).required()],"Error validating the sendMediaEvent command options.");return validator(options);};/* Copyright 2024 Adobe. All rights reserved. This file is licensed to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */var createStreamingMediaComponent=function createStreamingMediaComponent(_ref162){var config=_ref162.config,trackMediaEvent=_ref162.trackMediaEvent,trackMediaSession=_ref162.trackMediaSession,mediaResponseHandler=_ref162.mediaResponseHandler;return{lifecycle:{onBeforeEvent:function onBeforeEvent(_ref163){var mediaOptions=_ref163.mediaOptions,_ref163$onResponse=_ref163.onResponse,onResponse=_ref163$onResponse===void 0?noop:_ref163$onResponse;if(!mediaOptions){return;}var legacy=mediaOptions.legacy,playerId=mediaOptions.playerId,getPlayerDetails=mediaOptions.getPlayerDetails;if(legacy){return;}onResponse(function(_ref164){var response=_ref164.response;return mediaResponseHandler({playerId:playerId,getPlayerDetails:getPlayerDetails,response:response});});}},commands:{createMediaSession:{optionsValidator:function optionsValidator(options){return validateSessionOptions({options:options});},run:trackMediaSession},sendMediaEvent:{optionsValidator:function optionsValidator(options){return validateMediaEventOptions({options:options});},run:function run(options){if(!config.streamingMedia){return Promise.reject(new Error("Streaming media is not configured."));}return trackMediaEvent(options);}}}};};/* Copyright 2024 Adobe. All rights reserved. This file is licensed to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */var createTrackMediaSession=function createTrackMediaSession(_ref165){var config=_ref165.config,mediaEventManager=_ref165.mediaEventManager,mediaSessionCacheManager=_ref165.mediaSessionCacheManager,_ref165$legacy=_ref165.legacy,legacy=_ref165$legacy===void 0?false:_ref165$legacy;return function(options){if(!config.streamingMedia){return Promise.reject(new Error("Streaming media is not configured."));}var playerId=options.playerId,getPlayerDetails=options.getPlayerDetails;var event=mediaEventManager.createMediaSession(options);mediaEventManager.augmentMediaEvent({event:event,playerId:playerId,getPlayerDetails:getPlayerDetails});var sessionPromise=mediaEventManager.trackMediaSession({event:event,mediaOptions:{playerId:playerId,getPlayerDetails:getPlayerDetails,legacy:legacy}});mediaSessionCacheManager.storeSession({playerId:playerId,sessionDetails:{sessionPromise:sessionPromise,getPlayerDetails:getPlayerDetails,playbackState:PlaybackState.MAIN}});return sessionPromise;};};/* Copyright 2024 Adobe. All rights reserved. This file is licensed to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */var createMediaResponseHandler=function createMediaResponseHandler(_ref166){var mediaSessionCacheManager=_ref166.mediaSessionCacheManager,config=_ref166.config,trackMediaEvent=_ref166.trackMediaEvent;return function(_ref167){var response=_ref167.response,playerId=_ref167.playerId,getPlayerDetails=_ref167.getPlayerDetails;var mediaPayload=response.getPayloadsByType("media-analytics:new-session");if(isNonEmptyArray(mediaPayload)){var sessionId=mediaPayload[0].sessionId;if(isBlankString(sessionId)){return{};}if(!playerId||!getPlayerDetails){return{sessionId:sessionId};}var pingId=setTimeout(function(){trackMediaEvent({playerId:playerId,xdm:{eventType:MediaEvents.PING}});},config.streamingMedia.mainPingInterval*1000);mediaSessionCacheManager.savePing({playerId:playerId,pingId:pingId,playbackState:PlaybackState.MAIN});return{sessionId:sessionId};}return{};};};/* Copyright 2023 Adobe. All rights reserved. This file is licensed to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ /* eslint-disable import/no-restricted-paths */var createStreamingMedia=function createStreamingMedia(_ref168){var config=_ref168.config,logger=_ref168.logger,eventManager=_ref168.eventManager,sendEdgeNetworkRequest=_ref168.sendEdgeNetworkRequest,consent=_ref168.consent;var mediaSessionCacheManager=createMediaSessionCacheManager();var mediaEventManager=createMediaEventManager({config:config,eventManager:eventManager,logger:logger,consent:consent,sendEdgeNetworkRequest:sendEdgeNetworkRequest,setTimestamp:injectTimestamp(function(){return new Date();})});var trackMediaEvent=createTrackMediaEvent({mediaSessionCacheManager:mediaSessionCacheManager,mediaEventManager:mediaEventManager,config:config});var trackMediaSession=createTrackMediaSession({config:config,mediaEventManager:mediaEventManager,mediaSessionCacheManager:mediaSessionCacheManager});var mediaResponseHandler=createMediaResponseHandler({mediaSessionCacheManager:mediaSessionCacheManager,config:config,trackMediaEvent:trackMediaEvent});return createStreamingMediaComponent({config:config,trackMediaEvent:trackMediaEvent,mediaEventManager:mediaEventManager,mediaResponseHandler:mediaResponseHandler,trackMediaSession:trackMediaSession});};createStreamingMedia.namespace="Streaming media";createStreamingMedia.configValidators=configValidators;/* Copyright 2023 Adobe. All rights reserved. This file is licensed to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */var MEDIA_TYPE={Video:"video",Audio:"audio"};var STREAM_TYPE={VOD:"vod",Live:"live",Linear:"linear",Podcast:"podcast",Audiobook:"audiobook",AOD:"aod"};var PLAYER_STATE={FullScreen:"fullScreen",ClosedCaption:"closedCaptioning",Mute:"mute",PictureInPicture:"pictureInPicture",InFocus:"inFocus"};var EVENT={/** * Constant defining event type for AdBreak start */AdBreakStart:"adBreakStart",/** * Constant defining event type for AdBreak complete */AdBreakComplete:"adBreakComplete",/** * Constant defining event type for Ad start */AdStart:"adStart",/** * Constant defining event type for Ad complete */AdComplete:"adComplete",/** * Constant defining event type for Ad skip */AdSkip:"adSkip",/** * Constant defining event type for Chapter start */ChapterStart:"chapterStart",/** * Constant defining event type for Chapter complete */ChapterComplete:"chapterComplete",/** * Constant defining event type for Chapter skip */ChapterSkip:"chapterSkip",/** * Constant defining event type for Seek start */SeekStart:"seekStart",/** * Constant defining event type for Seek complete */SeekComplete:"seekComplete",/** * Constant defining event type for Buffer start */BufferStart:"bufferStart",/** * Constant defining event type for Buffer complete */BufferComplete:"bufferComplete",/** * Constant defining event type for change in Bitrate */BitrateChange:"bitrateChange",/** * Constant defining event type for Custom State Start */StateStart:"stateStart",/** * Constant defining event type for Custom State End */StateEnd:"stateEnd"};var MEDIA_EVENTS_INTERNAL={SessionStart:"sessionStart",SessionEnd:"sessionEnd",SessionComplete:"sessionComplete",Play:"play",Pause:"pauseStart",Error:"error",StateUpdate:"statesUpdate"};var MEDIA_OBJECT_KEYS={MediaResumed:"media.resumed",GranularAdTracking:"media.granularadtracking"};var VIDEO_METADATA_KEYS={Show:"a.media.show",Season:"a.media.season",Episode:"a.media.episode",AssetId:"a.media.asset",Genre:"a.media.genre",FirstAirDate:"a.media.airDate",FirstDigitalDate:"a.media.digitalDate",Rating:"a.media.rating",Originator:"a.media.originator",Network:"a.media.network",ShowType:"a.media.type",AdLoad:"a.media.adLoad",MVPD:"a.media.pass.mvpd",Authorized:"a.media.pass.auth",DayPart:"a.media.dayPart",Feed:"a.media.feed",StreamFormat:"a.media.format"};var AUDIO_METADATA_KEYS={Artist:"a.media.artist",Album:"a.media.album",Label:"a.media.label",Author:"a.media.author",Station:"a.media.station",Publisher:"a.media.publisher"};var AD_METADATA_KEYS={Advertiser:"a.media.ad.advertiser",CampaignId:"a.media.ad.campaign",CreativeId:"a.media.ad.creative",PlacementId:"a.media.ad.placement",SiteId:"a.media.ad.site",CreativeUrl:"a.media.ad.creativeURL"};/* Copyright 2024 Adobe. All rights reserved. This file is licensed to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */var createLegacyMediaComponent=function createLegacyMediaComponent(_ref169){var trackMediaEvent=_ref169.trackMediaEvent,trackMediaSession=_ref169.trackMediaSession,mediaResponseHandler=_ref169.mediaResponseHandler,logger=_ref169.logger,createMediaHelper=_ref169.createMediaHelper,createGetInstance=_ref169.createGetInstance,config=_ref169.config;return{lifecycle:{onBeforeEvent:function onBeforeEvent(_ref170){var mediaOptions=_ref170.mediaOptions,_ref170$onResponse=_ref170.onResponse,onResponse=_ref170$onResponse===void 0?noop:_ref170$onResponse;if(!mediaOptions){return;}var legacy=mediaOptions.legacy,playerId=mediaOptions.playerId,getPlayerDetails=mediaOptions.getPlayerDetails;if(!legacy){return;}onResponse(function(_ref171){var response=_ref171.response;return mediaResponseHandler({playerId:playerId,getPlayerDetails:getPlayerDetails,response:response});});}},commands:{getMediaAnalyticsTracker:{run:function run(){if(!config.streamingMedia){return Promise.reject(new Error("Streaming media is not configured."));}logger.info("Streaming media is configured in legacy mode.");var mediaAnalyticsHelper=createMediaHelper({logger:logger});return Promise.resolve(_objectSpread({getInstance:function getInstance(){return createGetInstance({logger:logger,trackMediaEvent:trackMediaEvent,trackMediaSession:trackMediaSession,uuid:v4});},Event:EVENT,MediaType:MEDIA_TYPE,PlayerState:PLAYER_STATE,StreamType:STREAM_TYPE,MediaObjectKey:MEDIA_OBJECT_KEYS,VideoMetadataKeys:VIDEO_METADATA_KEYS,AudioMetadataKeys:AUDIO_METADATA_KEYS,AdMetadataKeys:AD_METADATA_KEYS},mediaAnalyticsHelper));}}}};};/* Copyright 2023 Adobe. All rights reserved. This file is licensed to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */var createMediaHelper=function createMediaHelper(_ref172){var logger=_ref172.logger;var createMediaObject=function createMediaObject(friendlyName,name,length,contentType,streamType){var mediaObject={friendlyName:friendlyName,name:name,length:length,streamType:streamType,contentType:contentType};var validate=boundObjectOf({friendlyName:boundString().nonEmpty(),name:boundString().nonEmpty(),length:boundNumber().required(),streamType:boundString().nonEmpty(),contentType:boundString().nonEmpty()});try{var result=validate(mediaObject);var sessionDetails={name:result.name,friendlyName:result.friendlyName,length:result.length,streamType:result.streamType,contentType:result.contentType};return{sessionDetails:sessionDetails};}catch(error){logger.warn("An error occurred while creating the Media Object.",error);return{};}};var createAdBreakObject=function createAdBreakObject(name,position,startTime){var adBreakObject={friendlyName:name,offset:position,index:startTime};var validator=boundObjectOf({friendlyName:boundString().nonEmpty(),offset:boundNumber(),index:boundNumber()});try{var result=validator(adBreakObject);var advertisingPodDetails={friendlyName:result.friendlyName,offset:result.offset,index:result.index};return{advertisingPodDetails:advertisingPodDetails};}catch(error){logger.warn("An error occurred while creating the Ad Break Object.",error);return{};}};var createAdObject=function createAdObject(name,id,position,length){var adObject={friendlyName:name,name:id,podPosition:position,length:length};var validator=boundObjectOf({friendlyName:boundString().nonEmpty(),name:boundString().nonEmpty(),podPosition:boundNumber(),length:boundNumber()});try{var result=validator(adObject);var advertisingDetails={friendlyName:result.friendlyName,name:result.name,podPosition:result.podPosition,length:result.length};return{advertisingDetails:advertisingDetails};}catch(error){logger.warn("An error occurred while creating the Advertising Object.",error);return{};}};var createChapterObject=function createChapterObject(name,position,length,startTime){var chapterDetailsObject={friendlyName:name,offset:position,length:length,index:startTime};var validator=boundObjectOf({friendlyName:boundString().nonEmpty(),offset:boundNumber(),length:boundNumber(),index:boundNumber()});try{var result=validator(chapterDetailsObject);var chapterDetails={friendlyName:result.friendlyName,offset:result.offset,index:result.index,length:result.length};return{chapterDetails:chapterDetails};}catch(error){logger.warn("An error occurred while creating the Chapter Object.",error);return{};}};var createStateObject=function createStateObject(stateName){var STATE_NAME_REGEX=/^[a-zA-Z0-9_]{1,64}$/;var validator=boundString().matches(STATE_NAME_REGEX,"This is not a valid state name.");try{var result=validator(stateName);return{name:result};}catch(error){logger.warn("An error occurred while creating the State Object.",error);return{};}};var createQoEObject=function createQoEObject(bitrate,droppedFrames,fps,startupTime){var qoeObject={bitrate:bitrate,droppedFrames:droppedFrames,fps:fps,startupTime:startupTime};var validator=boundObjectOf({bitrate:boundNumber(),droppedFrames:boundNumber(),fps:boundNumber(),startupTime:boundNumber()});try{var result=validator(qoeObject);return{bitrate:result.bitrate,droppedFrames:result.droppedFrames,framesPerSecond:result.fps,timeToStart:result.startupTime};}catch(error){logger.warn("An error occurred while creating the QOE Object.",error);return{};}};return{createMediaObject:createMediaObject,createAdBreakObject:createAdBreakObject,createAdObject:createAdObject,createChapterObject:createChapterObject,createStateObject:createStateObject,createQoEObject:createQoEObject};};/* Copyright 2023 Adobe. All rights reserved. This file is licensed to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */var mediaToXdmKeys={"a.media.show":"show","a.media.season":"season","a.media.episode":"episode","a.media.asset":"assetID","a.media.genre":"genre","a.media.airDate":"firstAirDate","a.media.digitalDate":"firstDigitalDate","a.media.rating":"rating","a.media.originator":"originator","a.media.network":"network","a.media.type":"showType","a.media.adLoad":"adLoad","a.media.pass.mvpd":"mvpd","a.media.pass.auth":"authorized","a.media.dayPart":"dayPart","a.media.feed":"feed","a.media.format":"streamFormat","a.media.artist":"artist","a.media.album":"album","a.media.label":"label","a.media.author":"author","a.media.station":"station","a.media.publisher":"publisher","media.resumed":"hasResume"};var adsToXdmKeys={"a.media.ad.advertiser":"advertiser","a.media.ad.campaign":"campaignID","a.media.ad.creative":"creativeID","a.media.ad.placement":"placementID","a.media.ad.site":"siteID","a.media.ad.creativeURL":"creativeURL"};/* Copyright 2024 Adobe. All rights reserved. This file is licensed to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */var createGetInstance=function createGetInstance(_ref173){var logger=_ref173.logger,trackMediaSession=_ref173.trackMediaSession,trackMediaEvent=_ref173.trackMediaEvent,uuid=_ref173.uuid;var trackerState=null;var instantiateTracker=function instantiateTracker(){trackerState={qoe:null,lastPlayhead:0,playerId:uuid()};};var getEventType=function getEventType(_ref174){var eventType=_ref174.eventType;if(eventType===EVENT.BufferComplete||eventType===EVENT.SeekComplete){return MEDIA_EVENTS_INTERNAL.Play;}if(eventType===EVENT.StateStart||eventType===EVENT.StateEnd){return MEDIA_EVENTS_INTERNAL.StateUpdate;}if(eventType===EVENT.SeekStart){return MEDIA_EVENTS_INTERNAL.Pause;}return eventType;};var createXdmObject=function createXdmObject(_ref175){var eventType=_ref175.eventType,_ref175$mediaDetails=_ref175.mediaDetails,mediaDetails=_ref175$mediaDetails===void 0?{}:_ref175$mediaDetails,_ref175$contextData=_ref175.contextData,contextData=_ref175$contextData===void 0?[]:_ref175$contextData;var action=getEventType({eventType:eventType});if(eventType===EVENT.StateStart){var _xdm={eventType:"media.".concat(action),mediaCollection:{statesStart:[mediaDetails]}};return _xdm;}if(eventType===EVENT.StateEnd){var _xdm2={eventType:"media.".concat(action),mediaCollection:{statesEnd:[mediaDetails]}};return _xdm2;}var xdm={eventType:"media.".concat(action),mediaCollection:_objectSpread({},mediaDetails)};var customMetadata=[];Object.keys(contextData).forEach(function(key){if(mediaToXdmKeys[key]){xdm.mediaCollection.sessionDetails[mediaToXdmKeys[key]]=contextData[key];}else if(adsToXdmKeys[key]){xdm.mediaCollection.advertisingDetails[adsToXdmKeys[key]]=contextData[key];}else{customMetadata.push({name:key,value:contextData[key]});}});if(isNonEmptyArray(customMetadata)){xdm.mediaCollection.customMetadata=customMetadata;}return xdm;};return{trackSessionStart:function trackSessionStart(mediaObject){var contextData=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};if(isNil(mediaObject)||isEmptyObject(mediaObject)){logger.warn("Invalid media object");return{};}if(trackerState===null){logger.warn("The Media Session was completed. Restarting a new session.");instantiateTracker();}var xdm=createXdmObject({eventType:MEDIA_EVENTS_INTERNAL.SessionStart,mediaDetails:mediaObject,contextData:contextData});return trackMediaSession({playerId:trackerState.playerId,getPlayerDetails:function getPlayerDetails(){return{playhead:trackerState.lastPlayhead,qoeDataDetails:trackerState.qoe};},xdm:xdm});},trackPlay:function trackPlay(){if(trackerState===null){logger.warn("The Media Session was completed.");return{};}var xdm=createXdmObject({eventType:MEDIA_EVENTS_INTERNAL.Play});return trackMediaEvent({playerId:trackerState.playerId,xdm:xdm});},trackPause:function trackPause(){if(trackerState===null){logger.warn("The Media Session was completed.");return{};}var xdm=createXdmObject({eventType:MEDIA_EVENTS_INTERNAL.Pause});return trackMediaEvent({playerId:trackerState.playerId,xdm:xdm});},trackSessionEnd:function trackSessionEnd(){if(trackerState===null){logger.warn("The Media Session was completed.");return{};}var xdm=createXdmObject({eventType:MEDIA_EVENTS_INTERNAL.SessionEnd});return trackMediaEvent({playerId:trackerState.playerId,xdm:xdm});},trackComplete:function trackComplete(){if(trackerState===null){logger.warn("The Media Session was completed.");return{};}var xdm=createXdmObject({eventType:MEDIA_EVENTS_INTERNAL.SessionComplete});return trackMediaEvent({playerId:trackerState.playerId,xdm:xdm});},trackError:function trackError(errorId){logger.warn("trackError(".concat(errorId,")"));if(trackerState===null){logger.warn("The Media Session was completed.");return{};}var errorDetails={name:errorId,source:"player"};var xdm=createXdmObject({eventType:MEDIA_EVENTS_INTERNAL.Error,mediaDetails:{errorDetails:errorDetails}});return trackMediaEvent({playerId:trackerState.playerId,xdm:xdm});},trackEvent:function trackEvent(eventType,info,context){if(isEmptyObject(info)){logger.warn("Invalid media object.");return{};}if(trackerState===null){logger.warn("The Media Session was completed.");return{};}if(!includes(Object.values(EVENT),eventType)){logger.warn("Invalid event type");return{};}var xdm=createXdmObject({eventType:eventType,mediaDetails:info,contextData:context});return trackMediaEvent({playerId:trackerState.playerId,xdm:xdm});},updatePlayhead:function updatePlayhead(time){if(trackerState===null){logger.warn("The Media Session was completed.");return;}if(isNumber$1(time)){trackerState.lastPlayhead=parseInt(time,10);}},updateQoEObject:function updateQoEObject(qoeObject){if(trackerState===null){logger.warn("The Media Session was completed.");return;}if(!qoeObject){return;}trackerState.qoe=qoeObject;},destroy:function destroy(){logger.warn("Destroy called, destroying the tracker.");trackerState=null;}};};/* Copyright 2024 Adobe. All rights reserved. This file is licensed to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ /* eslint-disable import/no-restricted-paths */var createLegacyMediaAnalytics=function createLegacyMediaAnalytics(_ref176){var eventManager=_ref176.eventManager,sendEdgeNetworkRequest=_ref176.sendEdgeNetworkRequest,config=_ref176.config,logger=_ref176.logger,consent=_ref176.consent;var mediaSessionCacheManager=createMediaSessionCacheManager();var mediaEventManager=createMediaEventManager({sendEdgeNetworkRequest:sendEdgeNetworkRequest,config:config,consent:consent,eventManager:eventManager,setTimestamp:injectTimestamp(function(){return new Date();})});var trackMediaEvent=createTrackMediaEvent({mediaSessionCacheManager:mediaSessionCacheManager,mediaEventManager:mediaEventManager,config:config});var trackMediaSession=createTrackMediaSession({config:config,mediaEventManager:mediaEventManager,mediaSessionCacheManager:mediaSessionCacheManager,legacy:true});var mediaResponseHandler=createMediaResponseHandler({mediaSessionCacheManager:mediaSessionCacheManager,config:config,trackMediaEvent:trackMediaEvent});return createLegacyMediaComponent({mediaResponseHandler:mediaResponseHandler,trackMediaSession:trackMediaSession,trackMediaEvent:trackMediaEvent,createMediaHelper:createMediaHelper,createGetInstance:createGetInstance,logger:logger,config:config});};createLegacyMediaAnalytics.namespace="Legacy Media Analytics";/* Copyright 2023 Adobe. All rights reserved. This file is licensed to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ // TODO: Register the Components here statically for now. They might be registered differently. // TODO: Figure out how sub-components will be made available/registered var componentCreators=[createDataCollector,createActivityCollector,createIdentity,createAudiences,createPersonalization,createContext,createPrivacy,createEventMerge,createLibraryInfo,createMachineLearning,createDecisioningEngine,createLegacyMediaAnalytics,createStreamingMedia];/* Copyright 2019 Adobe. All rights reserved. This file is licensed to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */var CONFIG_DOC_URI="https://adobe.ly/3sHh553";var transformOptions=function transformOptions(_ref177){var combinedConfigValidator=_ref177.combinedConfigValidator,options=_ref177.options,logger=_ref177.logger;try{var validator=combinedConfigValidator.noUnknownFields().required();return validator.call({logger:logger},options);}catch(e){throw new Error("Resolve these configuration problems:\n\t - ".concat(e.message.split("\n").join("\n\t - "),"\nFor configuration documentation see: ").concat(CONFIG_DOC_URI));}};var buildAllOnInstanceConfiguredExtraParams=function buildAllOnInstanceConfiguredExtraParams(config,logger,componentCreators){return componentCreators.reduce(function(memo,_ref178){var buildOnInstanceConfiguredExtraParams=_ref178.buildOnInstanceConfiguredExtraParams;if(buildOnInstanceConfiguredExtraParams){(0,_reactorObjectAssign["default"])(memo,buildOnInstanceConfiguredExtraParams({config:config,logger:logger}));}return memo;},{});};var wrapLoggerInQueue=function wrapLoggerInQueue(logger){var queue=[];var queuedLogger={get enabled(){return logger.enabled;},flush:function flush(){queue.forEach(function(_ref179){var method=_ref179.method,args=_ref179.args;return logger[method].apply(logger,_toConsumableArray(args));});}};Object.keys(logger).filter(function(key){return typeof logger[key]==="function";}).forEach(function(method){queuedLogger[method]=function(){for(var _len9=arguments.length,args=new Array(_len9),_key9=0;_key9<_len9;_key9++){args[_key9]=arguments[_key9];}queue.push({method:method,args:args});};});return queuedLogger;};var buildAndValidateConfig=function buildAndValidateConfig(_ref180){var options=_ref180.options,componentCreators=_ref180.componentCreators,coreConfigValidators=_ref180.coreConfigValidators,createConfig=_ref180.createConfig,logger=_ref180.logger,setDebugEnabled=_ref180.setDebugEnabled;// We wrap the logger in a queue in case debugEnabled is set in the config // but we need to log something before the config is created. var queuedLogger=wrapLoggerInQueue(logger);var combinedConfigValidator=componentCreators.map(function(_ref181){var configValidators=_ref181.configValidators;return configValidators;}).filter(function(configValidators){return configValidators;}).reduce(function(validator,configValidators){return validator.concat(configValidators);},coreConfigValidators);var config=createConfig(transformOptions({combinedConfigValidator:combinedConfigValidator,options:options,logger:queuedLogger}));setDebugEnabled(config.debugEnabled,{fromConfig:true});queuedLogger.flush();// eslint-disable-next-line no-underscore-dangle var extraParams=buildAllOnInstanceConfiguredExtraParams(config,logger,componentCreators);logger.logOnInstanceConfigured(_objectSpread(_objectSpread({},extraParams),{},{config:config}));return config;};/* Copyright 2019 Adobe. All rights reserved. This file is licensed to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */var initializeComponents=function initializeComponents(_ref182){var componentCreators=_ref182.componentCreators,lifecycle=_ref182.lifecycle,componentRegistry=_ref182.componentRegistry,getImmediatelyAvailableTools=_ref182.getImmediatelyAvailableTools;componentCreators.forEach(function(createComponent){var namespace=createComponent.namespace;// TO-DOCUMENT: Helpers that we inject into factories. var tools=getImmediatelyAvailableTools(namespace);var component;try{component=createComponent(tools);}catch(error){throw stackError({error:error,message:"[".concat(namespace,"] An error occurred during component creation.")});}componentRegistry.register(namespace,component);});return lifecycle.onComponentsRegistered({lifecycle:lifecycle}).then(function(){return componentRegistry;});};/* Copyright 2019 Adobe. All rights reserved. This file is licensed to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */var createConfig=function createConfig(options){return(0,_reactorObjectAssign["default"])({},options);};/* Copyright 2019 Adobe. All rights reserved. This file is licensed to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */var EDGE="edge.adobedc.net";var ID_THIRD_PARTY="adobedc.demdex.net";/* Copyright 2023 Adobe. All rights reserved. This file is licensed to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */var EDGE_BASE_PATH="ee";/* Copyright 2019 Adobe. All rights reserved. This file is licensed to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */var createCoreConfigs=function createCoreConfigs(){return boundObjectOf({debugEnabled:boundBoolean()["default"](false),defaultConsent:boundEnumOf(IN,OUT,PENDING)["default"](IN),datastreamId:boundString().unique().required(),edgeDomain:boundString().domain()["default"](EDGE),edgeBasePath:boundString().nonEmpty()["default"](EDGE_BASE_PATH),orgId:boundString().unique().required(),onBeforeEventSend:boundCallback()["default"](noop),edgeConfigOverrides:validateConfigOverride}).renamed("edgeConfigId",boundString().unique(),"datastreamId");};/* Copyright 2019 Adobe. All rights reserved. This file is licensed to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */var injectHandleError=function injectHandleError(_ref183){var errorPrefix=_ref183.errorPrefix,logger=_ref183.logger;return function(error,operation){var err=toError(error);// In the case of declined consent, we've opted to not reject the promise // returned to the customer, but instead resolve the promise with an // empty result object. if(err.code===DECLINED_CONSENT_ERROR_CODE){logger.warn("The ".concat(operation," could not fully complete. ").concat(err.message));return{};}updateErrorMessage({error:err,message:"".concat(errorPrefix," ").concat(err.message)});throw err;};};/* Copyright 2019 Adobe. All rights reserved. This file is licensed to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */var injectSendFetchRequest=function injectSendFetchRequest(_ref184){var fetch=_ref184.fetch;return function(url,body){return fetch(url,{method:"POST",cache:"no-cache",credentials:"include",// To set the cookie header in the request. headers:{"Content-Type":"text/plain; charset=UTF-8"},referrerPolicy:"no-referrer-when-downgrade",body:body}).then(function(response){return response.text().then(function(responseBody){return{statusCode:response.status,// We expose headers through a function instead of creating an object // with all the headers up front largely because the native // request.getResponseHeader method is case-insensitive but also because it prevents // us from having to add header parsing logic when using XHR to make requests. getHeader:function getHeader(name){return response.headers.get(name);},body:responseBody};});});};};/* Copyright 2019 Adobe. All rights reserved. This file is licensed to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */var injectSendXhrRequest=function injectSendXhrRequest(_ref185){var XMLHttpRequest=_ref185.XMLHttpRequest;return function(url,body){return new Promise(function(resolve,reject){var request=new XMLHttpRequest();request.onreadystatechange=function(){if(request.readyState===4){if(request.status===0){reject(new Error("Request aborted."));}else{resolve({statusCode:request.status,// We expose headers through a function instead of creating an object // with all the headers up front because: // 1. It avoids having to add header parsing code to get all headers. // 2. The native request.getResponseHeader method is case-insensitive. getHeader:function getHeader(name){return request.getResponseHeader(name);},body:request.responseText});}}};request.onloadstart=function(){request.responseType="text";};request.open("POST",url,true);request.setRequestHeader("Content-Type","text/plain; charset=UTF-8");request.withCredentials=true;request.onerror=reject;request.onabort=reject;request.send(body);});};};/* Copyright 2019 Adobe. All rights reserved. This file is licensed to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */var injectSendBeaconRequest=function injectSendBeaconRequest(_ref186){var sendBeacon=_ref186.sendBeacon,sendFetchRequest=_ref186.sendFetchRequest,logger=_ref186.logger;return function(url,body){var blob=new Blob([body],{type:"text/plain; charset=UTF-8"});if(!sendBeacon(url,blob)){logger.info("Unable to use `sendBeacon`; falling back to `fetch`.");return sendFetchRequest(url,body);}// Using sendBeacon, we technically don't get a response back from // the server, but we'll resolve the promise with an object to maintain // consistency with other network strategies. return Promise.resolve({statusCode:204,getHeader:function getHeader(){return null;},body:""});};};/* Copyright 2019 Adobe. All rights reserved. This file is licensed to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */var createLogger=function createLogger(_ref187){var getDebugEnabled=_ref187.getDebugEnabled,console=_ref187.console,getMonitors=_ref187.getMonitors,context=_ref187.context;var prefix="[".concat(context.instanceName,"]");if(context.componentName){prefix+=" [".concat(context.componentName,"]");}var notifyMonitors=function notifyMonitors(method,data){var monitors=getMonitors();if(monitors.length>0){var dataWithContext=(0,_reactorObjectAssign["default"])({},context,data);monitors.forEach(function(monitor){if(monitor[method]){monitor[method](dataWithContext);}});}};var log=function log(level){for(var _len10=arguments.length,rest=new Array(_len10>1?_len10-1:0),_key10=1;_key10<_len10;_key10++){rest[_key10-1]=arguments[_key10];}notifyMonitors("onBeforeLog",{level:level,arguments:rest});if(getDebugEnabled()){console[level].apply(console,[prefix].concat(rest));}};return{get enabled(){return getMonitors().length>0||getDebugEnabled();},logOnInstanceCreated:function logOnInstanceCreated(data){notifyMonitors("onInstanceCreated",data);log("info","Instance initialized.");},logOnInstanceConfigured:function logOnInstanceConfigured(data){notifyMonitors("onInstanceConfigured",data);log("info","Instance configured. Computed configuration:",data.config);},logOnBeforeCommand:function logOnBeforeCommand(data){notifyMonitors("onBeforeCommand",data);log("info","Executing ".concat(data.commandName," command. Options:"),data.options);},logOnCommandResolved:function logOnCommandResolved(data){notifyMonitors("onCommandResolved",data);log("info","".concat(data.commandName," command resolved. Result:"),data.result);},logOnCommandRejected:function logOnCommandRejected(data){notifyMonitors("onCommandRejected",data);log("error","".concat(data.commandName," command was rejected. Error:"),data.error);},logOnBeforeNetworkRequest:function logOnBeforeNetworkRequest(data){notifyMonitors("onBeforeNetworkRequest",data);log("info","Request ".concat(data.requestId,": Sending request."),data.payload);},logOnNetworkResponse:function logOnNetworkResponse(data){notifyMonitors("onNetworkResponse",data);var messagesSuffix=data.parsedBody||data.body?"response body:":"no response body.";log("info","Request ".concat(data.requestId,": Received response with status code ").concat(data.statusCode," and ").concat(messagesSuffix),data.parsedBody||data.body);},logOnNetworkError:function logOnNetworkError(data){notifyMonitors("onNetworkError",data);log("error","Request ".concat(data.requestId,": Network request failed."),data.error);},/** * Outputs informational message to the web console. In some * browsers a small "i" icon is displayed next to these items * in the web console's log. * @param {...*} arg Any argument to be logged. */info:log.bind(null,"info"),/** * Outputs a warning message to the web console. * @param {...*} arg Any argument to be logged. */warn:log.bind(null,"warn"),/** * Outputs an error message to the web console. * @param {...*} arg Any argument to be logged. */error:log.bind(null,"error")};};/* Copyright 2019 Adobe. All rights reserved. This file is licensed to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */var EVENT_CANCELLATION_MESSAGE="Event was canceled because the onBeforeEventSend callback returned false.";var createEventManager=function createEventManager(_ref188){var config=_ref188.config,logger=_ref188.logger,lifecycle=_ref188.lifecycle,consent=_ref188.consent,createEvent=_ref188.createEvent,createDataCollectionRequestPayload=_ref188.createDataCollectionRequestPayload,createDataCollectionRequest=_ref188.createDataCollectionRequest,sendEdgeNetworkRequest=_ref188.sendEdgeNetworkRequest,_applyResponse=_ref188.applyResponse;var onBeforeEventSend=config.onBeforeEventSend,globalConfigOverrides=config.edgeConfigOverrides;return{createEvent:createEvent,/** * Sends an event. This includes running the event and payload through the * appropriate lifecycle hooks, sending the request to the server, and * handling the response. * @param {Object} event This will be JSON stringified and used inside the * request payload. * @param {Object} [options] Options to pass on to the onBeforeEvent * lifecycle method * @param {Object} [options.edgeConfigOverrides] Settings that take * precedence over the global datastream configuration, including which * datastream to use. * @returns {*} */sendEvent:function sendEvent(event){var options=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};var localConfigOverrides=options.edgeConfigOverrides,otherOptions=_objectWithoutProperties(options,_excluded6);var requestParams=createRequestParams({payload:createDataCollectionRequestPayload(),localConfigOverrides:localConfigOverrides,globalConfigOverrides:globalConfigOverrides});var request=createDataCollectionRequest(requestParams);var onResponseCallbackAggregator=createCallbackAggregator();var onRequestFailureCallbackAggregator=createCallbackAggregator();return lifecycle.onBeforeEvent(_objectSpread(_objectSpread({},otherOptions),{},{event:event,onResponse:onResponseCallbackAggregator.add,onRequestFailure:onRequestFailureCallbackAggregator.add})).then(function(){requestParams.payload.addEvent(event);return consent.awaitConsent();}).then(function(){try{// NOTE: this calls onBeforeEventSend callback (if configured) event.finalize(onBeforeEventSend);}catch(error){var throwError=function throwError(){throw error;};onRequestFailureCallbackAggregator.add(lifecycle.onRequestFailure);return onRequestFailureCallbackAggregator.call({error:error}).then(throwError,throwError);}// if the callback returns false, the event should not be sent if(!event.shouldSend()){onRequestFailureCallbackAggregator.add(lifecycle.onRequestFailure);logger.info(EVENT_CANCELLATION_MESSAGE);var error=new Error(EVENT_CANCELLATION_MESSAGE);return onRequestFailureCallbackAggregator.call({error:error}).then(function(){// Ensure the promise gets resolved with undefined instead // of an array of return values from the callbacks. });}return sendEdgeNetworkRequest({request:request,runOnResponseCallbacks:onResponseCallbackAggregator.call,runOnRequestFailureCallbacks:onRequestFailureCallbackAggregator.call});});},applyResponse:function applyResponse(event){var options=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};var _options$renderDecisi2=options.renderDecisions,renderDecisions=_options$renderDecisi2===void 0?false:_options$renderDecisi2,_options$decisionCont2=options.decisionContext,decisionContext=_options$decisionCont2===void 0?{}:_options$decisionCont2,_options$responseHead2=options.responseHeaders,responseHeaders=_options$responseHead2===void 0?{}:_options$responseHead2,_options$responseBody2=options.responseBody,responseBody=_options$responseBody2===void 0?{handle:[]}:_options$responseBody2,personalization=options.personalization;var payload=createDataCollectionRequestPayload();var request=createDataCollectionRequest({payload:payload});var onResponseCallbackAggregator=createCallbackAggregator();return lifecycle.onBeforeEvent({event:event,renderDecisions:renderDecisions,decisionContext:decisionContext,decisionScopes:[PAGE_WIDE_SCOPE],personalization:personalization,onResponse:onResponseCallbackAggregator.add,onRequestFailure:noop}).then(function(){payload.addEvent(event);return _applyResponse({request:request,responseHeaders:responseHeaders,responseBody:responseBody,runOnResponseCallbacks:onResponseCallbackAggregator.call});});}};};/* Copyright 2019 Adobe. All rights reserved. This file is licensed to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */var STATE_STORE_HANDLE_TYPE="state:store";var createCookieTransfer=function createCookieTransfer(_ref189){var cookieJar=_ref189.cookieJar,shouldTransferCookie=_ref189.shouldTransferCookie,apexDomain=_ref189.apexDomain,dateProvider=_ref189.dateProvider;return{/** * When sending to a third-party endpoint, the endpoint won't be able to * access first-party cookies, therefore we transfer cookies into * the request body so they can be read by the server. */cookiesToPayload:function cookiesToPayload(payload,endpointDomain){var isEndpointFirstParty=endsWith(endpointDomain,apexDomain);var state={domain:apexDomain,cookiesEnabled:true};// If the endpoint is first-party, there's no need to transfer cookies // to the payload since they'll be automatically passed through cookie // headers. if(!isEndpointFirstParty){var cookies=cookieJar.get();var entries=Object.keys(cookies).filter(shouldTransferCookie).map(function(qualifyingCookieName){return{key:qualifyingCookieName,value:cookies[qualifyingCookieName]};});if(entries.length){state.entries=entries;}}payload.mergeState(state);},/** * When receiving from a third-party endpoint, the endpoint won't be able to * write first-party cookies, therefore we write first-party cookies * as directed in the response body. */responseToCookies:function responseToCookies(response){response.getPayloadsByType(STATE_STORE_HANDLE_TYPE).forEach(function(stateItem){var options={domain:apexDomain};var sameSite=stateItem.attrs&&stateItem.attrs.SameSite&&stateItem.attrs.SameSite.toLowerCase();if(stateItem.maxAge!==undefined){// cookieJar expects "expires" as a date object options.expires=new Date(dateProvider().getTime()+stateItem.maxAge*1000);}if(sameSite!==undefined){options.sameSite=sameSite;}// When sameSite is set to none, the secure flag must be set. // Experience edge will not set the secure flag in these cases. if(sameSite==="none"){options.secure=true;}cookieJar.set(stateItem.key,stateItem.value,options);});}};};/* Copyright 2022 Adobe. All rights reserved. This file is licensed to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */var MBOX_EDGE_CLUSTER="mboxEdgeCluster";var AT_QA_MODE="at_qa_mode";var MBOX="mbox";/* Copyright 2022 Adobe. All rights reserved. This file is licensed to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */var injectShouldTransferCookie=function injectShouldTransferCookie(_ref190){var orgId=_ref190.orgId,targetMigrationEnabled=_ref190.targetMigrationEnabled;return function(name){// We have a contract with the server that we will pass // all cookies whose names are namespaced according to the // logic in isNamespacedCookieName as well as any legacy // cookie names (so that the server can handle migrating // identities on websites previously using Visitor.js) return isNamespacedCookieName(orgId,name)||name===AT_QA_MODE||targetMigrationEnabled&&name===MBOX;};};/* Copyright 2023 Adobe. All rights reserved. This file is licensed to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */var apiVersion="v1";/* Copyright 2023 Adobe. All rights reserved. This file is licensed to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */var mergeLifecycleResponses=function mergeLifecycleResponses(returnValues){// Merges all returned objects from all `onResponse` callbacks into // a single object that can later be returned to the customer. var lifecycleOnResponseReturnValues=returnValues.shift()||[];var consumerOnResponseReturnValues=returnValues.shift()||[];var lifecycleOnBeforeRequestReturnValues=returnValues;return assignConcatArrayValues.apply(void 0,[{}].concat(_toConsumableArray(lifecycleOnResponseReturnValues),_toConsumableArray(consumerOnResponseReturnValues),_toConsumableArray(lifecycleOnBeforeRequestReturnValues)));};/* Copyright 2023 Adobe. All rights reserved. This file is licensed to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */var handleRequestFailure=function handleRequestFailure(onRequestFailureCallbackAggregator){return function(error){// Regardless of whether the network call failed, an unexpected status // code was returned, or the response body was malformed, we want to call // the onRequestFailure callbacks, but still throw the exception. var throwError=function throwError(){throw error;};return onRequestFailureCallbackAggregator.call({error:error}).then(throwError,throwError);};};/* Copyright 2019 Adobe. All rights reserved. This file is licensed to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */var injectSendEdgeNetworkRequest=function injectSendEdgeNetworkRequest(_ref191){var config=_ref191.config,lifecycle=_ref191.lifecycle,cookieTransfer=_ref191.cookieTransfer,sendNetworkRequest=_ref191.sendNetworkRequest,createResponse=_ref191.createResponse,processWarningsAndErrors=_ref191.processWarningsAndErrors,getLocationHint=_ref191.getLocationHint,getAssuranceValidationTokenParams=_ref191.getAssuranceValidationTokenParams;var edgeDomain=config.edgeDomain,edgeBasePath=config.edgeBasePath,datastreamId=config.datastreamId;/** * Sends a network request that is aware of payload interfaces, * lifecycle methods, configured edge domains, response structures, etc. */return function(_ref192){var request=_ref192.request,_ref192$runOnResponse=_ref192.runOnResponseCallbacks,runOnResponseCallbacks=_ref192$runOnResponse===void 0?noop:_ref192$runOnResponse,_ref192$runOnRequestF=_ref192.runOnRequestFailureCallbacks,runOnRequestFailureCallbacks=_ref192$runOnRequestF===void 0?noop:_ref192$runOnRequestF;var onResponseCallbackAggregator=createCallbackAggregator();onResponseCallbackAggregator.add(lifecycle.onResponse);onResponseCallbackAggregator.add(runOnResponseCallbacks);var onRequestFailureCallbackAggregator=createCallbackAggregator();onRequestFailureCallbackAggregator.add(lifecycle.onRequestFailure);onRequestFailureCallbackAggregator.add(runOnRequestFailureCallbacks);return lifecycle.onBeforeRequest({request:request,onResponse:onResponseCallbackAggregator.add,onRequestFailure:onRequestFailureCallbackAggregator.add}).then(function(){var endpointDomain=request.getUseIdThirdPartyDomain()?ID_THIRD_PARTY:edgeDomain;var locationHint=getLocationHint();var edgeBasePathWithLocationHint=locationHint?"".concat(edgeBasePath,"/").concat(locationHint).concat(request.getEdgeSubPath()):"".concat(edgeBasePath).concat(request.getEdgeSubPath());var configId=request.getDatastreamIdOverride()||datastreamId;var payload=request.getPayload();if(configId!==datastreamId){payload.mergeMeta({sdkConfig:{datastream:{original:datastreamId}}});}var url="https://".concat(endpointDomain,"/").concat(edgeBasePathWithLocationHint,"/").concat(apiVersion,"/").concat(request.getAction(),"?configId=").concat(configId,"&requestId=").concat(request.getId()).concat(getAssuranceValidationTokenParams());cookieTransfer.cookiesToPayload(payload,endpointDomain);return sendNetworkRequest({requestId:request.getId(),url:url,payload:payload,useSendBeacon:request.getUseSendBeacon()});}).then(function(networkResponse){processWarningsAndErrors(networkResponse);return networkResponse;})["catch"](handleRequestFailure(onRequestFailureCallbackAggregator)).then(function(_ref193){var parsedBody=_ref193.parsedBody,getHeader=_ref193.getHeader;// Note that networkResponse.parsedBody may be undefined if it was a // 204 No Content response. That's fine. var response=createResponse({content:parsedBody,getHeader:getHeader});cookieTransfer.responseToCookies(response);// Notice we're calling the onResponse lifecycle method even if there are errors // inside the response body. This is because the full request didn't actually fail-- // only portions of it that are considered non-fatal (a specific, non-critical // Konductor plugin, for example). return onResponseCallbackAggregator.call({response:response}).then(mergeLifecycleResponses);});};};/* Copyright 2020 Adobe. All rights reserved. This file is licensed to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */var NO_CONTENT=204;var TOO_MANY_REQUESTS=429;var BAD_GATEWAY=502;var SERVICE_UNAVAILABLE=503;var GATEWAY_TIMEOUT=504;/* Copyright 2019 Adobe. All rights reserved. This file is licensed to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */var MESSAGE_PREFIX="The server responded with a";var injectProcessWarningsAndErrors=function injectProcessWarningsAndErrors(_ref194){var logger=_ref194.logger;return function(networkResponse){var statusCode=networkResponse.statusCode,body=networkResponse.body,parsedBody=networkResponse.parsedBody;if(statusCode<200||statusCode>=300||!parsedBody&&statusCode!==NO_CONTENT||parsedBody&&!Array.isArray(parsedBody.handle)){var bodyToLog=parsedBody?JSON.stringify(parsedBody,null,2):body;var messageSuffix=bodyToLog?"response body:\n".concat(bodyToLog):"no response body.";throw new Error("".concat(MESSAGE_PREFIX," status code ").concat(statusCode," and ").concat(messageSuffix));}if(parsedBody){var _parsedBody$warnings=parsedBody.warnings,warnings=_parsedBody$warnings===void 0?[]:_parsedBody$warnings,_parsedBody$errors=parsedBody.errors,errors=_parsedBody$errors===void 0?[]:_parsedBody$errors;warnings.forEach(function(warning){logger.warn("".concat(MESSAGE_PREFIX," warning:"),warning);});errors.forEach(function(error){logger.error("".concat(MESSAGE_PREFIX," non-fatal error:"),error);});}};};/* Copyright 2022 Adobe. All rights reserved. This file is licensed to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */var injectGetLocationHint=function injectGetLocationHint(_ref195){var orgId=_ref195.orgId,cookieJar=_ref195.cookieJar;var clusterCookieName=getNamespacedCookieName(orgId,CLUSTER);var fromClusterCookie=function fromClusterCookie(){return cookieJar.get(clusterCookieName);};var fromTarget=function fromTarget(){var mboxEdgeCluster=cookieJar.get(MBOX_EDGE_CLUSTER);if(mboxEdgeCluster){return"t".concat(mboxEdgeCluster);}return undefined;};return function(){return fromClusterCookie()||fromTarget();};};/* Copyright 2019 Adobe. All rights reserved. This file is licensed to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */var MAX_RETRIES=3;var RETRYABLE_STATUS_CODES=[TOO_MANY_REQUESTS,SERVICE_UNAVAILABLE,BAD_GATEWAY,GATEWAY_TIMEOUT];// These rules are in accordance with // https://git.corp.adobe.com/pages/experience-edge/konductor/#/apis/errors?id=handling-4xx-and-5xx-responses var isRequestRetryable=function isRequestRetryable(_ref196){var response=_ref196.response,retriesAttempted=_ref196.retriesAttempted;return retriesAttempted0&&arguments[0]!==undefined?arguments[0]:{};var eventOptionsValidator=boundObjectOf({name:boundString()["default"]("alloy"),monitors:boundArrayOf(boundObjectOf({}))["default"]([])}).noUnknownFields();var _eventOptionsValidato=eventOptionsValidator(options),name=_eventOptionsValidato.name,monitors=_eventOptionsValidato.monitors;// this is a function so that window.__alloyMonitors can be set or added to at any time // eslint-disable-next-line no-underscore-dangle var getMonitors=function getMonitors(){return(window.__alloyMonitors||[]).concat(monitors);};var logController=createLogController({console:console,locationSearch:window.location.search,createLogger:createLogger,instanceName:name,createNamespacedStorage:createNamespacedStorage,getMonitors:getMonitors});var instance=createExecuteCommand({instanceName:name,logController:logController});logController.logger.logOnInstanceCreated({instance:instance});return instance;}; } }, "adobe-alloy/dist/lib/instanceManager/createInstanceManager.js": { "script": function(module, exports, require, turbine) { "use strict"; function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); } var _excluded = ["name", "edgeConfigId", "stagingEdgeConfigId", "developmentEdgeConfigId", "onBeforeEventSend"]; function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; } function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; } function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; } function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; } function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); } function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], t.indexOf(o) >= 0 || {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; } function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (e.indexOf(n) >= 0) continue; t[n] = r[n]; } return t; } /* Copyright 2019 Adobe. All rights reserved. This file is licensed to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ module.exports = function (_ref) { var turbine = _ref.turbine, window = _ref.window, createInstance = _ref.createInstance, _createEventMergeId = _ref.createEventMergeId, orgId = _ref.orgId, wrapOnBeforeEventSend = _ref.wrapOnBeforeEventSend, getConfigOverrides = _ref.getConfigOverrides; var _turbine$getExtension = turbine.getExtensionSettings(), instancesSettings = _turbine$getExtension.instances; var instanceByName = {}; instancesSettings.forEach(function (_ref2) { var name = _ref2.name, edgeConfigId = _ref2.edgeConfigId, stagingEdgeConfigId = _ref2.stagingEdgeConfigId, developmentEdgeConfigId = _ref2.developmentEdgeConfigId, onBeforeEventSend = _ref2.onBeforeEventSend, options = _objectWithoutProperties(_ref2, _excluded); var instance = createInstance({ name: name }); window[name] = instance; if (!window.__alloyNS) { window.__alloyNS = []; } window.__alloyNS.push(name); instanceByName[name] = instance; var environment = turbine.environment && turbine.environment.stage; var computedEdgeConfigId = environment === "development" && developmentEdgeConfigId || environment === "staging" && stagingEdgeConfigId || edgeConfigId; options.edgeConfigOverrides = getConfigOverrides(options); instance("configure", _objectSpread(_objectSpread({}, options), {}, { datastreamId: computedEdgeConfigId, debugEnabled: turbine.debugEnabled, orgId: options.orgId || orgId, onBeforeEventSend: wrapOnBeforeEventSend(onBeforeEventSend) })); turbine.onDebugChanged(function (enabled) { instance("setDebug", { enabled: enabled }); }); }); return { /** * Returns an instance by name. * @param name * @returns {Function} */ getInstance: function getInstance(name) { return instanceByName[name]; }, /** * Synchronously creates an event merge ID. * @returns {string} */ createEventMergeId: function createEventMergeId() { return _createEventMergeId(); } }; }; } }, "adobe-alloy/dist/lib/instanceManager/injectWrapOnBeforeEventSend.js": { "script": function(module, exports, require, turbine) { "use strict"; /* Copyright 2020 Adobe. All rights reserved. This file is licensed to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ module.exports = function (_ref) { var version = _ref.version; return function (onBeforeEventSend) { return function (content) { content.xdm.implementationDetails.name = "".concat(content.xdm.implementationDetails.name, "/reactor"); content.xdm.implementationDetails.version = "".concat(content.xdm.implementationDetails.version, "+").concat(version); if (onBeforeEventSend) { return onBeforeEventSend(content); } return undefined; }; }; }; } }, "adobe-alloy/dist/lib/createEventMergeIdCache.js": { "script": function(module, exports, require, turbine) { "use strict"; /* Copyright 2020 Adobe. All rights reserved. This file is licensed to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ module.exports = function () { var eventMergeIdByCacheId = {}; /** * Caches event merge IDs by a cache ID. */ return { set: function set(cacheId, eventMergeId) { eventMergeIdByCacheId[cacheId] = eventMergeId; }, getByCacheId: function getByCacheId(cacheId) { return eventMergeIdByCacheId[cacheId]; }, clearByEventMergeId: function clearByEventMergeId(eventMergeId) { Object.keys(eventMergeIdByCacheId).forEach(function (cacheId) { if (eventMergeIdByCacheId[cacheId] === eventMergeId) { delete eventMergeIdByCacheId[cacheId]; } }); } }; }; } }, "adobe-alloy/dist/lib/createSendEventCallbackStorage.js": { "script": function(module, exports, require, turbine) { "use strict"; /* Copyright 2021 Adobe. All rights reserved. This file is licensed to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ module.exports = function () { var sendEventCompleteTriggers = []; return { add: function add(trigger) { sendEventCompleteTriggers.push(trigger); }, triggerEvent: function triggerEvent(result) { sendEventCompleteTriggers.forEach(function (trigger) { trigger(result); }); } }; }; } }, "adobe-alloy/dist/lib/createMediaCollectionSessionStorage.js": { "script": function(module, exports, require, turbine) { "use strict"; /* Copyright 2024 Adobe. All rights reserved. This file is licensed to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ module.exports = function () { var mediaCollectionSessionStorage = {}; return { add: function add(_ref) { var playerId = _ref.playerId, sessionDetails = _ref.sessionDetails; if (mediaCollectionSessionStorage[playerId]) { throw new Error("Player Id ".concat(playerId, " already exists")); } mediaCollectionSessionStorage[playerId] = sessionDetails; }, remove: function remove(_ref2) { var playerId = _ref2.playerId; mediaCollectionSessionStorage[playerId] = undefined; }, get: function get(_ref3) { var playerId = _ref3.playerId; return mediaCollectionSessionStorage[playerId]; } }; }; } }, "adobe-alloy/dist/lib/createVariableStore.js": { "script": function(module, exports, require, turbine) { "use strict"; /* Copyright 2019 Adobe. All rights reserved. This file is licensed to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ // This is just a store of variables indexed by their cacheId module.exports = function () { return {}; }; } } } }, "gcoe-adobe-client-data-layer": { "displayName": "Adobe Client Data Layer", "hostedLibFilesBaseUrl": "https://tags.tiqcdn.com/utag/bb21ab6b5ba9/a07a1f8bc49d/964953434e6a/hostedLibFiles/EP6e4c031a8b7640d7ac3fab013fa28b17/", "settings": { "dataLayerName": "adobeDataLayer", "injectLibrary": true }, "modules": { "gcoe-adobe-client-data-layer/src/lib/dataElements/datalayerComputedState.js": { "name": "datalayer-computed-state", "displayName": "Data Layer Computed State", "script": function(module, exports, require, turbine) { 'use strict'; function index(obj, i) { return obj[i] } /** * Returns the current computed state of the data layer. * @param settings Object containing the settings * @returns {Object|undefined} */ module.exports = function (settings, event) { if (typeof settings !== 'undefined' && settings !== null) { var dl = getDataLayer(); if (typeof dl !== 'undefined') { if (settings.path !== '') { return dl.getState(settings.path); } else { return dl.getState(); } } } }; var getDataLayer = require('../util/getDataLayer'); } }, "gcoe-adobe-client-data-layer/src/lib/events/datalayerPushListener.js": { "name": "datalayer-push", "displayName": "Data Pushed", "script": function(module, exports, require, turbine) { 'use strict'; /** * Registers on either all data pushes, all events or specific events * @param settings Object containing the settings * @param trigger Fn to be called once triggered */ module.exports = function (settings, trigger) { if (typeof settings !== 'undefined' && settings !== null) { var method = settings.method; var eventKey = settings.eventKey; var scope = settings.scope; var dl = getDataLayer(); /** * Function to be called by the Adobe Client Data Layer * @param event The event object pushed to the data layer that triggered the callback. */ var handler = function (event) { //beforeState and afterState are included to support backwards compatibility for implementations using ACDL version < 2.0 var result = { message: event, beforeState: {}, afterState: {}, fullState: dl.getState() }; trigger(result); }; var options = {}; if (typeof scope !== 'undefined') { options.scope = scope; } // Register to all data pushes if (method === 'allData') { dl.push(function (dl) { dl.addEventListener("adobeDataLayer:change", handler, options); }); } // Register to all event pushes else if (method === 'allEvents') { dl.push(function (dl) { dl.addEventListener("adobeDataLayer:event", handler, options); }); } // Only listen to specific events else if (method === 'specificEvent' && eventKey !== '') { dl.push(function (dl) { dl.addEventListener(eventKey, handler, options); }); } } }; var getDataLayer = require('../util/getDataLayer'); } }, "gcoe-adobe-client-data-layer/src/lib/main.js": { "script": function(module, exports, require, turbine) { var globalSettings = turbine.getExtensionSettings(); var dataLayerName = globalSettings.dataLayerName; var injectLibrary = globalSettings.injectLibrary; window.adobeDataLayer = window.adobeDataLayer || []; /* if adobeDataLayer is not an object - change it */ if ('object' !== typeof (window.adobeDataLayer)) { turbine.logger.log('Initializing adobeDataLayer to [] as it isn\'t an object yet.'); window.adobeDataLayer = []; } /* if a new name has been passed, ask adobeDataLayer to use it*/ if ('adobeDataLayer' !== dataLayerName) { if(typeof window[dataLayerName] === 'object') { turbine.logger.log('Using "' + dataLayerName + '" instead of "adobeDataLayer" as data layer name.'); window.adobeDataLayer.push(function (dl) { // push existing events from window[dataLayerName] to adobeDataLayer for (var i = 0; i < window[dataLayerName].length; i++) { dl.push(window[dataLayerName][i]); } // set the reference of the existing data layer object to the new one window[dataLayerName] = dl }); } else { turbine.logger.warn('Could not use "' + dataLayerName + '" instead of "adobeDataLayer", because the object does not exist!'); } } if(injectLibrary) { /* Check if the wrapper ACDL is already loaded or not- check a specific function (getState) - USE CASE : Launch in AEM - AEM already loading ACDL*/ if ("undefined" === typeof window.adobeDataLayer.getState) { turbine.logger.log('Initializing adobeDataLayer as it wasn\'t found during the initialization.'); "use strict";function _slicedToArray(t,e){return _arrayWithHoles(t)||_iterableToArrayLimit(t,e)||_unsupportedIterableToArray(t,e)||_nonIterableRest()}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _iterableToArrayLimit(t,e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(t)){var n=[],r=!0,o=!1,a=void 0;try{for(var i,u=t[Symbol.iterator]();!(r=(i=u.next()).done)&&(n.push(i.value),!e||n.length!==e);r=!0);}catch(t){o=!0,a=t}finally{try{r||null==u.return||u.return()}finally{if(o)throw a}}return n}}function _arrayWithHoles(t){if(Array.isArray(t))return t}function _createForOfIteratorHelper(t){if("undefined"==typeof Symbol||null==t[Symbol.iterator]){if(Array.isArray(t)||(t=_unsupportedIterableToArray(t))){var e=0,n=function(){};return{s:n,n:function(){return e>=t.length?{done:!0}:{done:!1,value:t[e++]}},e:function(t){throw t},f:n}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var r,o,a=!0,i=!1;return{s:function(){r=t[Symbol.iterator]()},n:function(){var t=r.next();return a=t.done,t},e:function(t){i=!0,o=t},f:function(){try{a||null==r.return||r.return()}finally{if(i)throw o}}}}function _unsupportedIterableToArray(t,e){if(t){if("string"==typeof t)return _arrayLikeToArray(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?_arrayLikeToArray(t,e):void 0}}function _arrayLikeToArray(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n>>0,r>>>=0,o=Array(i);++an.length-1?[]:n.slice(0,t.index).map(function(t){return y(t)})}}function s(t){var e="The following item cannot be handled by the data layer because it does not have a valid format: "+JSON.stringify(t.config);console.error(e)}return function(){Array.isArray(e.dataLayer)||(e.dataLayer=[]);r=e.dataLayer.splice(0,e.dataLayer.length),(n=e.dataLayer).version=c,o={},f=h(a)}(),n.push=function(t){var n=arguments,r=arguments;if(Object.keys(n).forEach(function(t){var e=y(n[t]);switch(e.valid||(s(e),delete r[t]),e.type){case v.itemType.DATA:case v.itemType.EVENT:u(e);break;case v.itemType.FCTN:delete r[t],u(e);break;case v.itemType.LISTENER_ON:case v.itemType.LISTENER_OFF:delete r[t]}}),r[0])return Array.prototype.push.apply(this,r)},n.getState=function(t){return t?p(l(o),t):l(o)},n.addEventListener=function(t,e,n){u(y({on:t,handler:e,scope:n&&n.scope,path:n&&n.path}))},n.removeEventListener=function(t,e){u(y({off:t,handler:e}))},function(){for(var t=0;t= pageHeightInPixels) { // no scrolling on this short page state.targetScrollDepthReached = settings.fireOnShortPages; } else { // create a listener for scrolling var targetScrollDepthInPixels = (pageHeightInPixels - viewportHeightInPixels) * targetScrollDepth / 100; window.addEventListener('scroll', function(e) { try { var currentScrollDepthInPixels = document.documentElement.scrollTop; if (currentScrollDepthInPixels >= targetScrollDepthInPixels) { state.targetScrollDepthReached = true; if (state.targetTimeSpentReached) { if (state.hasTriggered === false || settings.fireOnce === false) { state.hasTriggered = true; // check global state to see if we're allowed to trigger // we want to avoid out of order events turbine.logger.info("Considering trigger bcs scroll...", allowOutOfOrder, globalState, targetScrollDepth); if (allowOutOfOrder || globalState.lowestAllowedToFire <= targetScrollDepth) { // record for global state if (globalState.lowestAllowedToFire <= targetScrollDepth) { globalState.lowestAllowedToFire = targetScrollDepth; } // now trigger trigger({ "subType": "scrollDepth", // set the targetScrollDepth in the event // so that it can be used with a Rule's conditions and actions "scrollDepth": targetScrollDepth }); } } } } } catch(e2) { } }, supportsPassive ? { passive: true } : false ); } } catch(e) { } }, initDelay); }; } } } }, "common-web-sdk-plugins": { "displayName": "Common Web SDK Plugins", "hostedLibFilesBaseUrl": "https://tags.tiqcdn.com/utag/bb21ab6b5ba9/a07a1f8bc49d/964953434e6a/hostedLibFiles/EP72fbeb9839644a1daa8eca9f84e02dcf/", "modules": { "common-web-sdk-plugins/src/lib/dataElements/getpreviousvalue.js": { "name": "getpreviousvalue", "displayName": "getPreviousValue", "script": function(module, exports, require, turbine) { 'use strict'; const cookie = require('@adobe/reactor-cookie'); function getPreviousValue(variableToCheck, cookieName) { //return version and set contextData (if available) if(variableToCheck === "-v") return {"plugin": "getPreviousValue", "version": "4.0.0"} var cookieValue, //set the cookieName argument equal to "s_gpv" by default cookieName = cookieName || "s_gpv", //create a dateObject and set it equal to 30 minutes from now dateObject = new Date(); dateObject.setTime(dateObject.getTime() + 18E5); //if we can read the cookieName, set cookieValue equal to it cookieValue = typeof cookie.get(cookieName)==='undefined'?'':cookie.get(cookieName); //if variableToCheck is set, write the cookieName equal to the variableToCheck value, to expire in 30 minutes. if(variableToCheck) cookie.set(cookieName, variableToCheck, {expires: dateObject}) else cookie.set(cookieName, cookieValue, {expires:dateObject}); //return cookieValue (the *previous* value of variableToCheck as contained in the cookieName before the cookieName was overwritten with the *new* variableToCheck value) return cookieValue; } module.exports = function(settings) { return getPreviousValue(settings.variableToCheck, settings.cookieName); }; } } } }, "core": { "displayName": "Core", "hostedLibFilesBaseUrl": "https://tags.tiqcdn.com/utag/bb21ab6b5ba9/a07a1f8bc49d/964953434e6a/hostedLibFiles/EP1fdd2a6ec2ae468fb1d2cac08df65f83/", "settings": { "cspNonce": "%nonce%" }, "modules": { "core/src/lib/dataElements/customCode.js": { "name": "custom-code", "displayName": "Custom Code", "script": function(module, exports, require, turbine) { /*************************************************************************************** * Copyright 2019 Adobe. All rights reserved. * This file is licensed to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. You may obtain a copy * of the License at http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software distributed under * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS * OF ANY KIND, either express or implied. See the License for the specific language * governing permissions and limitations under the License. ****************************************************************************************/ 'use strict'; /** * The custom data element. * @param {Object} settings The data element settings object. * @param {string} settings.source The function that should be called which will return a value. * @param {string} event The event (if any) that triggered the evaluation of the data element. * @returns {string} */ module.exports = function (settings, event) { return settings.source(event); }; } }, "core/src/lib/dataElements/queryStringParameter.js": { "name": "query-string-parameter", "displayName": "Query String Parameter", "script": function(module, exports, require, turbine) { /*************************************************************************************** * Copyright 2019 Adobe. All rights reserved. * This file is licensed to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. You may obtain a copy * of the License at http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software distributed under * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS * OF ANY KIND, either express or implied. See the License for the specific language * governing permissions and limitations under the License. ****************************************************************************************/ 'use strict'; var window = require('@adobe/reactor-window'); var queryString = require('@adobe/reactor-query-string'); /** * The query string parameter data element. * @param {Object} settings The data element settings object. * @param {string} settings.name The query string parameter name. * @param {string} [settings.caseInsensitive] Whether casing should be ignored. * @returns {string} */ module.exports = function (settings) { var queryParams = queryString.parse(window.location.search); if (settings.caseInsensitive) { var lowerCaseName = settings.name.toLowerCase(); var keys = Object.keys(queryParams); for (var i = 0; i < keys.length; i++) { var key = keys[i]; if (key.toLowerCase() === lowerCaseName) { return queryParams[key]; } } } else { return queryParams[settings.name]; } }; } }, "core/src/lib/dataElements/javascriptVariable.js": { "name": "javascript-variable", "displayName": "JavaScript Variable", "script": function(module, exports, require, turbine) { /*************************************************************************************** * Copyright 2019 Adobe. All rights reserved. * This file is licensed to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. You may obtain a copy * of the License at http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software distributed under * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS * OF ANY KIND, either express or implied. See the License for the specific language * governing permissions and limitations under the License. ****************************************************************************************/ 'use strict'; var getObjectProperty = require('../helpers/getObjectProperty.js'); /** * The variable data element. * @param {Object} settings The data element settings object. * @param {string} settings.path The global path to the variable holding the data element value. * @returns {string} */ module.exports = function (settings) { return getObjectProperty(window, settings.path); }; } }, "core/src/lib/dataElements/cookie.js": { "name": "cookie", "displayName": "Cookie", "script": function(module, exports, require, turbine) { /*************************************************************************************** * Copyright 2019 Adobe. All rights reserved. * This file is licensed to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. You may obtain a copy * of the License at http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software distributed under * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS * OF ANY KIND, either express or implied. See the License for the specific language * governing permissions and limitations under the License. ****************************************************************************************/ 'use strict'; var cookie = require('@adobe/reactor-cookie'); /** * The cookie data element. * @param {Object} settings The data element settings object. * @param {string} settings.name The name of the cookie for which a value should be retrieved. * @returns {string} */ module.exports = function (settings) { return cookie.get(settings.name); }; } }, "core/src/lib/events/libraryLoaded.js": { "name": "library-loaded", "displayName": "Library Loaded (Page Top)", "script": function(module, exports, require, turbine) { /*************************************************************************************** * Copyright 2019 Adobe. All rights reserved. * This file is licensed to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. You may obtain a copy * of the License at http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software distributed under * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS * OF ANY KIND, either express or implied. See the License for the specific language * governing permissions and limitations under the License. ****************************************************************************************/ 'use strict'; var pageLifecycleEvents = require('./helpers/pageLifecycleEvents'); /** * Library loaded event. This event occurs as soon as the runtime library is loaded. * @param {Object} settings The event settings object. * @param {ruleTrigger} trigger The trigger callback. */ module.exports = function (settings, trigger) { pageLifecycleEvents.registerLibraryLoadedTrigger(trigger); }; } }, "core/src/lib/conditions/valueComparison.js": { "name": "value-comparison", "displayName": "Value Comparison", "script": function(module, exports, require, turbine) { /*************************************************************************************** * (c) 2018 Adobe. All rights reserved. * This file is licensed to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. You may obtain a copy * of the License at http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software distributed under * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS * OF ANY KIND, either express or implied. See the License for the specific language * governing permissions and limitations under the License. ****************************************************************************************/ /*eslint eqeqeq:0*/ 'use strict'; var isString = require('../helpers/stringAndNumberUtils').isString; var isNumber = require('../helpers/stringAndNumberUtils').isNumber; var castToStringIfNumber = require('../helpers/stringAndNumberUtils').castToStringIfNumber; var castToNumberIfString = require('../helpers/stringAndNumberUtils').castToNumberIfString; var updateCase = function (operand, caseInsensitive) { return caseInsensitive && isString(operand) ? operand.toLowerCase() : operand; }; var guardStringCompare = function (compare) { return function (leftOperand, rightOperand, caseInsensitive) { leftOperand = castToStringIfNumber(leftOperand); rightOperand = castToStringIfNumber(rightOperand); return ( isString(leftOperand) && isString(rightOperand) && compare(leftOperand, rightOperand, caseInsensitive) ); }; }; var guardNumberCompare = function (compare) { return function (leftOperand, rightOperand) { leftOperand = castToNumberIfString(leftOperand); rightOperand = castToNumberIfString(rightOperand); return ( isNumber(leftOperand) && isNumber(rightOperand) && compare(leftOperand, rightOperand) ); }; }; var guardCaseSensitivity = function (compare) { return function (leftOperand, rightOperand, caseInsensitive) { return compare( updateCase(leftOperand, caseInsensitive), updateCase(rightOperand, caseInsensitive) ); }; }; var conditions = { equals: guardCaseSensitivity(function (leftOperand, rightOperand) { return leftOperand == rightOperand; }), doesNotEqual: function () { return !conditions.equals.apply(null, arguments); }, contains: guardStringCompare( guardCaseSensitivity(function (leftOperand, rightOperand) { return leftOperand.indexOf(rightOperand) !== -1; }) ), doesNotContain: function () { return !conditions.contains.apply(null, arguments); }, startsWith: guardStringCompare( guardCaseSensitivity(function (leftOperand, rightOperand) { return leftOperand.indexOf(rightOperand) === 0; }) ), doesNotStartWith: function () { return !conditions.startsWith.apply(null, arguments); }, endsWith: guardStringCompare( guardCaseSensitivity(function (leftOperand, rightOperand) { return ( leftOperand.substring( leftOperand.length - rightOperand.length, leftOperand.length ) === rightOperand ); }) ), doesNotEndWith: function () { return !conditions.endsWith.apply(null, arguments); }, matchesRegex: guardStringCompare(function ( leftOperand, rightOperand, caseInsensitive ) { // Doing something like new RegExp(/ab+c/, 'i') throws an error in some browsers (e.g., IE11), // so we don't want to instantiate the regex until we know we're working with a string. return new RegExp(rightOperand, caseInsensitive ? 'i' : '').test( leftOperand ); }), doesNotMatchRegex: function () { return !conditions.matchesRegex.apply(null, arguments); }, lessThan: guardNumberCompare(function (leftOperand, rightOperand) { return leftOperand < rightOperand; }), lessThanOrEqual: guardNumberCompare(function (leftOperand, rightOperand) { return leftOperand <= rightOperand; }), greaterThan: guardNumberCompare(function (leftOperand, rightOperand) { return leftOperand > rightOperand; }), greaterThanOrEqual: guardNumberCompare(function (leftOperand, rightOperand) { return leftOperand >= rightOperand; }), isTrue: function (leftOperand) { return leftOperand === true; }, isTruthy: function (leftOperand) { return Boolean(leftOperand); }, isFalse: function (leftOperand) { return leftOperand === false; }, isFalsy: function (leftOperand) { return !leftOperand; } }; module.exports = function (settings) { return conditions[settings.comparison.operator]( settings.leftOperand, settings.rightOperand, Boolean(settings.comparison.caseInsensitive) ); }; } }, "core/src/lib/actions/customCode.js": { "name": "custom-code", "displayName": "Custom Code", "script": function(module, exports, require, turbine) { /*************************************************************************************** * Copyright 2019 Adobe. All rights reserved. * This file is licensed to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. You may obtain a copy * of the License at http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software distributed under * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS * OF ANY KIND, either express or implied. See the License for the specific language * governing permissions and limitations under the License. ****************************************************************************************/ 'use strict'; var document = require('@adobe/reactor-document'); var Promise = require('@adobe/reactor-promise'); var decorateCode = require('./helpers/decorateCode'); var loadCodeSequentially = require('./helpers/loadCodeSequentially'); var postscribe = require('../../../node_modules/postscribe/dist/postscribe'); var unescapeHTMLEntities = require('./helpers/unescapeHtmlCode'); var getTurbineScript = require('../helpers/findPageScript').getTurbine; var cspNonce; var postscribeWrite = (function () { var write = function (source) { postscribe(document.body, source, { beforeWriteToken: function (token) { var tagName = token.tagName && token.tagName.toLowerCase(); if (cspNonce && tagName === 'script') { token.attrs.nonce = cspNonce; } // There is an issue in Postscribe where script and style attributes // are not unescaped. That causes problems when loading scripts from external // sources. See https://jira.corp.adobe.com/browse/DTM-15058. if (tagName === 'script' || tagName === 'style') { Object.keys(token.attrs || {}).forEach(function (key) { token.attrs[key] = unescapeHTMLEntities(token.attrs[key]); }); if (token.src) { token.src = unescapeHTMLEntities(token.src); } } return token; }, error: function (error) { turbine.logger.error(error.msg); } }); }; var queue = []; // If the Launch library is loaded asynchronously, it may finish loading before document.body // is available. This means the custom code action may be running before document.body is // available, in which case can't write the custom code to document.body. We could, in this // case, write it to document.head since it will for sure be available, but the user's custom // code may have something like an img tag for sending a beacon (this use case was seen in DTM). // Adding display elements like an img tag to document.head is against HTML spec, though it // does seem like an image request is still made. We opted instead to ensure we comply with // HTML spec and wait until we see that document.body is available before writing. var flushQueue = function () { if (document.body) { while (queue.length) { write(queue.shift()); } } else { // 20 is an arbitrarily small amount of time but not too aggressive. setTimeout(flushQueue, 20); } }; return function (source) { queue.push(source); flushQueue(); }; })(); var libraryWasLoadedAsynchronously = (function () { // document.currentScript is not supported by IE if (document.currentScript) { return document.currentScript.async; } else { var script = getTurbineScript(); if (script) { return script.async; } // We couldn't find the Launch script, so we'll assume it was loaded asynchronously. This // is the safer assumption. return true; } })(); /** * The custom code action. This loads and executes custom JavaScript or HTML provided by the user. * @param {Object} settings Action settings. * @params {boolean} settings.isExternal When true, settings.source contains the * code itself. When false, settings.source contains a relative path to the file * containing the user's code. * @param {string} settings.source If settings.external is false, * this will be the user's code. Otherwise, it will be a relative path to the file containing * the user's code. * @param {string} settings.language The language of the user's code. Must be either javascript or * html. * @param {Object} event The underlying event object that triggered the rule. * @param {Object} event.element The element that the rule was targeting. * @param {Object} event.target The element on which the event occurred. * javascript or html. */ module.exports = function (settings, event) { // ensure the nonce is up-to-date when the function is used cspNonce = turbine.getExtensionSettings().cspNonce; var decoratedResult; var action = { settings: settings, event: event }; var source = action.settings.source; if (!source) { return; } if (action.settings.isExternal) { return loadCodeSequentially(source).then(function (source) { if (source) { decoratedResult = decorateCode(action, source); postscribeWrite(decoratedResult.code); return decoratedResult.promise; } return Promise.resolve(); }); } else { decoratedResult = decorateCode(action, source); // This area has been modified several times, so here are some helpful details: // 1. Custom code will be included into the main launch library if it's for a rule that uses the // Library Loaded or Page Bottom event. isExternal will be false. However, keep in mind that // the same rule may have other events that are not Library Loaded or Page Bottom. This means // we could see isExternal = false on the action when the event that fired the rule is // a click, for example. // 2. When users load a library synchronously which has a rule using the Library Loaded // or Page Bottom event with a Custom Code action, they expect the custom code to be written // to the document in a blocking fashion (prevent the parser from continuing until their // custom code is executed). In other words, they expect document.write to be used. When // the library is loaded asynchronously, they do not have this expectation. However, note // that if the Library Loaded event is used and the website does not call // _satellite.pageBottom(), page bottom rules will be run when the DOMContentLoaded event // is fired (at which point we can't use document.write or it will wipe out website content). // 3. Calls to document.write will be ignored by the browser if the Launch library is loaded // asynchronously, even if the calls are made before DOMContentLoaded. // 4. There's a bug in IE 10 where readyState is sometimes set to "interactive" too // early (before DOMContentLoaded has fired). https://bugs.jquery.com/ticket/12282 // This may cause Postscribe to be used sometimes when document.write() could have been // used instead, but we have concluded that IE 10 usage is low enough and the risk small // enough that this behavior is tolerable. if (!libraryWasLoadedAsynchronously && document.readyState === 'loading') { // Document object in XML files is different from the ones in HTML files. Documents served // with the `application/xhtml+xml` MIME type don't have the `document.write` method. // More info: // https://www.w3.org/MarkUp/2004/xhtml-faq#docwrite // https://developer.mozilla.org/en-US/docs/Archive/Web/Writing_JavaScript_for_HTML // Also, when rule component sequencing is enabled, there is an issue in Edge Legacy // where the whole page gets erased: https://jira.corp.adobe.com/browse/DTM-13527. // We decided to not use document.write at all when rule component sequencing is enabled. if ( document.write && turbine.propertySettings.ruleComponentSequencingEnabled === false ) { document.write(decoratedResult.code); } else { postscribeWrite(decoratedResult.code); } } else { postscribeWrite(decoratedResult.code); } return decoratedResult.promise; } }; } }, "core/src/lib/conditions/customCode.js": { "name": "custom-code", "displayName": "Custom Code", "script": function(module, exports, require, turbine) { /*************************************************************************************** * Copyright 2019 Adobe. All rights reserved. * This file is licensed to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. You may obtain a copy * of the License at http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software distributed under * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS * OF ANY KIND, either express or implied. See the License for the specific language * governing permissions and limitations under the License. ****************************************************************************************/ 'use strict'; /** * Custom code condition. This executes condition code provided by the user. * @param {Object} settings Condition settings. * @param {Function} settings.source The custom script function. * @param {Object} event The underlying event object that triggered the rule. * @param {Object} event.element The element that the rule was targeting. * @param {Object} event.target The element on which the event occurred. * @returns {boolean} */ module.exports = function (settings, event) { // `this` and `target` are provided separately from event for backward-compatibility. return settings.source.call(event.element, event, event.target); }; } }, "core/src/lib/events/focus.js": { "name": "focus", "displayName": "Focus", "script": function(module, exports, require, turbine) { /*************************************************************************************** * Copyright 2019 Adobe. All rights reserved. * This file is licensed to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. You may obtain a copy * of the License at http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software distributed under * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS * OF ANY KIND, either express or implied. See the License for the specific language * governing permissions and limitations under the License. ****************************************************************************************/ 'use strict'; var bubbly = require('./helpers/createBubbly')(); document.addEventListener('focus', bubbly.evaluateEvent, true); /** * The focus event. This event occurs when an element has received focus. * @param {Object} settings The event settings object. * @param {string} [settings.elementSelector] The CSS selector the element must match in order for * the rule to fire. * @param {Object[]} [settings.elementProperties] Property values the element must have in order * for the rule to fire. * @param {string} settings.elementProperties[].name The property name. * @param {string} settings.elementProperties[].value The property value. * @param {boolean} [settings.elementProperties[].valueIsRegex=false] Whether value * on the object instance is intended to be a regular expression. * @param {boolean} [settings.bubbleFireIfParent=true] Whether the rule should fire if * the event originated from a descendant element. * @param {boolean} [settings.bubbleFireIfChildFired=true] Whether the rule should fire * if the same event has already triggered a rule targeting a descendant element. * @param {boolean} [settings.bubbleStop=false] Whether the event should not trigger * rules on ancestor elements. * @param {ruleTrigger} trigger The trigger callback. */ module.exports = function (settings, trigger) { bubbly.addListener(settings, trigger); }; } }, "core/src/lib/events/mediaPause.js": { "name": "media-pause", "displayName": "Media Pause", "script": function(module, exports, require, turbine) { /*************************************************************************************** * Copyright 2019 Adobe. All rights reserved. * This file is licensed to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. You may obtain a copy * of the License at http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software distributed under * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS * OF ANY KIND, either express or implied. See the License for the specific language * governing permissions and limitations under the License. ****************************************************************************************/ 'use strict'; var bubbly = require('./helpers/createBubbly')(); document.addEventListener('pause', bubbly.evaluateEvent, true); /** * The pause event. This event occurs when playback has been paused. * @param {Object} settings The event settings object. * @param {string} [settings.elementSelector] The CSS selector the element must match in order for * the rule to fire. * @param {Object[]} [settings.elementProperties] Property values the element must have in order * for the rule to fire. * @param {string} settings.elementProperties[].name The property name. * @param {string} settings.elementProperties[].value The property value. * @param {boolean} [settings.elementProperties[].valueIsRegex=false] Whether value * on the object instance is intended to be a regular expression. * @param {boolean} [settings.bubbleFireIfParent=true] Whether the rule should fire if * the event originated from a descendant element. * @param {boolean} [settings.bubbleFireIfChildFired=true] Whether the rule should fire * if the same event has already triggered a rule targeting a descendant element. * @param {boolean} [settings.bubbleStop=false] Whether the event should not trigger * rules on ancestor elements. * @param {ruleTrigger} trigger The trigger callback. */ module.exports = function (settings, trigger) { bubbly.addListener(settings, trigger); }; } }, "core/src/lib/events/mediaTimePlayed.js": { "name": "media-time-played", "displayName": "Media Time Played", "script": function(module, exports, require, turbine) { /*************************************************************************************** * Copyright 2019 Adobe. All rights reserved. * This file is licensed to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. You may obtain a copy * of the License at http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software distributed under * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS * OF ANY KIND, either express or implied. See the License for the specific language * governing permissions and limitations under the License. ****************************************************************************************/ 'use strict'; var bubbly = require('./helpers/createBubbly')(); var WeakMap = require('./helpers/weakMap'); var castToNumberIfString = require('../helpers/stringAndNumberUtils').castToNumberIfString; var lastTriggeredByElement = new WeakMap(); var relevantMarkers = []; /** * Unit string values. * @enum {string} */ var timePlayedUnit = { SECOND: 'second', PERCENT: 'percent' }; var handleTimeUpdate = function (event) { var target = event.target; if (!target.seekable || !target.seekable.length) { return; } var seekable = target.seekable; var startTime = seekable.start(0); var endTime = seekable.end(0); var currentTime = target.currentTime; var playedSeconds = currentTime - startTime; var secondsLastTriggered = lastTriggeredByElement.get(target) || 0; relevantMarkers.forEach(function (relevantMarker) { var configuredSeconds = relevantMarker.unit === timePlayedUnit.SECOND ? relevantMarker.amount : (endTime - startTime) * (relevantMarker.amount / 100); if ( configuredSeconds > secondsLastTriggered && configuredSeconds <= playedSeconds ) { bubbly.evaluateEvent( { target: target, amount: relevantMarker.amount, unit: relevantMarker.unit }, true ); } }); lastTriggeredByElement.set(target, playedSeconds); }; document.addEventListener('timeupdate', handleTimeUpdate, true); /** * The time played event. This event occurs when the media has been played for a specified amount * of time. * @param {Object} settings The event settings object. * @param {string} [settings.elementSelector] The CSS selector the element must match in order for * the rule to fire. * @param {Object[]} [settings.elementProperties] Property values the element must have in order * for the rule to fire. * @param {string} settings.elementProperties[].name The property name. * @param {string} settings.elementProperties[].value The property value. * @param {boolean} [settings.elementProperties[].valueIsRegex=false] Whether value * on the object instance is intended to be a regular expression. * @param {number|string} settings.amount The amount of time the media must be played before * this event is fired. This value may either be number of seconds (20 for 20 seconds) or a * percent value (20 for 20%). * @param {timePlayedUnit} settings.unit The unit of duration measurement. * @param {boolean} [settings.bubbleFireIfParent=true] Whether the rule should fire if * the event originated from a descendant element. * @param {boolean} [settings.bubbleFireIfChildFired=true] Whether the rule should fire * if the same event has already triggered a rule targeting a descendant element. * @param {boolean} [settings.bubbleStop=false] Whether the event should not trigger * rules on ancestor elements. * @param {ruleTrigger} trigger The trigger callback. */ module.exports = function (settings, trigger) { var amount = castToNumberIfString(settings.amount); var doesMarkerMatch = function (marker) { return marker.amount === amount && marker.unit === settings.unit; }; var markerRegistered = relevantMarkers.some(doesMarkerMatch); if (!markerRegistered) { relevantMarkers.push({ amount: amount, unit: settings.unit }); } bubbly.addListener(settings, function (syntheticEvent) { var amount = castToNumberIfString(settings.amount); // Bubbling for this event is dependent upon the amount and unit configured for rules. // An event can "bubble up" to other rules with the same amount and unit but not to rules with // a different amount or unit. See the tests for how this plays out. if ( syntheticEvent.amount === amount && syntheticEvent.unit === settings.unit ) { trigger(syntheticEvent); } else { return false; } }); }; } }, "core/src/lib/events/directCall.js": { "name": "direct-call", "displayName": "Direct Call", "script": function(module, exports, require, turbine) { /*************************************************************************************** * Copyright 2019 Adobe. All rights reserved. * This file is licensed to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. You may obtain a copy * of the License at http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software distributed under * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS * OF ANY KIND, either express or implied. See the License for the specific language * governing permissions and limitations under the License. ****************************************************************************************/ 'use strict'; /** * Object where the key is the call name and the value is an array of all rule trigger functions * for that call name. * @type {Object} */ var triggersByIdentifier = {}; window._satellite = window._satellite || {}; /** * Public function intended to be called by the user. * @param {string} identifier The identifier passed to _satellite.track(). * @param {*} [detail] Any detail that should be passed along to conditions and actions. */ window._satellite.track = function (identifier, detail) { identifier = identifier.trim(); var triggers = triggersByIdentifier[identifier]; if (triggers) { var syntheticEvent = { identifier: identifier, detail: detail }; triggers.forEach(function (trigger) { trigger(syntheticEvent); }); var logMessage = 'Rules using the direct call event type with identifier "' + identifier + '" have been triggered' + (detail ? ' with additional detail:' : '.'); var logArgs = [logMessage]; if (detail) { logArgs.push(detail); } turbine.logger.log.apply(turbine.logger, logArgs); } else { turbine.logger.log( '"' + identifier + '" does not match any direct call identifiers.' ); } }; /** * Direct call event. This event occurs as soon as the user calls _satellite.track(). * @param {Object} settings The event settings object. * @param {string} settings.identifier The identifier passed to _satellite.track(). * @param {ruleTrigger} trigger The trigger callback. */ module.exports = function (settings, trigger) { var triggers = triggersByIdentifier[settings.identifier]; if (!triggers) { triggers = triggersByIdentifier[settings.identifier] = []; } triggers.push(trigger); }; } }, "core/src/lib/events/dataElementChange.js": { "name": "data-element-change", "displayName": "Data Element Change", "script": function(module, exports, require, turbine) { /*************************************************************************************** * Copyright 2019 Adobe. All rights reserved. * This file is licensed to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. You may obtain a copy * of the License at http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software distributed under * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS * OF ANY KIND, either express or implied. See the License for the specific language * governing permissions and limitations under the License. ****************************************************************************************/ 'use strict'; var POLL_INTERVAL = 1000; var triggersByName = {}; var cachedStringifiedValueByName = {}; setInterval(function () { Object.keys(triggersByName).forEach(function (name) { var stringifiedValue = JSON.stringify(turbine.getDataElementValue(name)); if (stringifiedValue !== cachedStringifiedValueByName[name]) { var syntheticEvent = { dataElementName: name }; triggersByName[name].forEach(function (trigger) { trigger(syntheticEvent); }); cachedStringifiedValueByName[name] = stringifiedValue; } }); }, POLL_INTERVAL); /** * Data element change event. This event occurs whenever the given data element's value has changed. * @param {Object} settings The event settings object. * @param {string} settings.name The name of the data element. * @param {ruleTrigger} trigger The trigger callback. */ module.exports = function (settings, trigger) { var name = settings.name; var triggers = triggersByName[name]; if (!triggers) { triggers = triggersByName[name] = []; cachedStringifiedValueByName[name] = JSON.stringify( turbine.getDataElementValue(name) ); } triggers.push(trigger); }; } }, "core/src/lib/events/mediaPlay.js": { "name": "media-play", "displayName": "Media Play", "script": function(module, exports, require, turbine) { /*************************************************************************************** * Copyright 2019 Adobe. All rights reserved. * This file is licensed to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. You may obtain a copy * of the License at http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software distributed under * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS * OF ANY KIND, either express or implied. See the License for the specific language * governing permissions and limitations under the License. ****************************************************************************************/ 'use strict'; var bubbly = require('./helpers/createBubbly')(); document.addEventListener('play', bubbly.evaluateEvent, true); /** * The play event. This event occurs when playback has begun. * @param {Object} settings The event settings object. * @param {string} [settings.elementSelector] The CSS selector the element must match in order for * the rule to fire. * @param {Object[]} [settings.elementProperties] Property values the element must have in order * for the rule to fire. * @param {string} settings.elementProperties[].name The property name. * @param {string} settings.elementProperties[].value The property value. * @param {boolean} [settings.elementProperties[].valueIsRegex=false] Whether value * on the object instance is intended to be a regular expression. * @param {boolean} [settings.bubbleFireIfParent=true] Whether the rule should fire if * the event originated from a descendant element. * @param {boolean} [settings.bubbleFireIfChildFired=true] Whether the rule should fire * if the same event has already triggered a rule targeting a descendant element. * @param {boolean} [settings.bubbleStop=false] Whether the event should not trigger * rules on ancestor elements. * @param {ruleTrigger} trigger The trigger callback. */ module.exports = function (settings, trigger) { bubbly.addListener(settings, trigger); }; } }, "core/src/lib/events/click.js": { "name": "click", "displayName": "Click", "script": function(module, exports, require, turbine) { /*************************************************************************************** * Copyright 2019 Adobe. All rights reserved. * This file is licensed to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. You may obtain a copy * of the License at http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software distributed under * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS * OF ANY KIND, either express or implied. See the License for the specific language * governing permissions and limitations under the License. ****************************************************************************************/ 'use strict'; var window = require('@adobe/reactor-window'); var bubbly = require('./helpers/createBubbly')(); var WeakMap = require('./helpers/weakMap'); var evaluatedEvents = new WeakMap(); var MIDDLE_MOUSE_BUTTON = 2; var castToNumberIfString = require('../helpers/stringAndNumberUtils').castToNumberIfString; /** * Determines whether an element is a link that would navigate the user's current window to a * different URL. * @param {MouseEvent} e * @returns {boolean} */ var getDelayableLink = function (e) { // user is modifying click with the keyboard, don't delay the navigation if (e.ctrlKey || e.metaKey || e.button === MIDDLE_MOUSE_BUTTON) { return undefined; } var node = e.target; while (node) { var tagName = node.tagName; if (tagName && tagName.toLowerCase() === 'a') { var href = node.getAttribute('href'); var target = node.getAttribute('target'); if ( href && (!target || target === '_self' || (target === '_top' && window.top === window) || target === window.name) ) { return node; } else { // Found hyperlink conditions in which we don't want to delay navigation return undefined; } } node = node.parentNode; } }; document.addEventListener('click', bubbly.evaluateEvent, true); /** * The click event. This event occurs when a user has clicked an element. * @param {Object} settings - The event settings object. * @param {string} [settings.elementSelector] - The CSS selector the element must match in order for * the rule to fire. * @param {Object[]} settings.elementProperties - Property values the element must have in order * for the rule to fire. * @param {string} settings.elementProperties[].name - The property name. * @param {string} settings.elementProperties[].value - The property value. * @param {number|string} [settings.anchorDelay] - When present and a link is clicked, actual * navigation will be postponed for a period of time equal with its value. This is typically used to * allow time for scripts within the rule to execute, beacons to be sent to servers, etc. * @param {boolean} settings.elementProperties[].valueIsRegex=false - Whether value * on the object instance is intended to be a regular expression. * @param {boolean} settings.bubbleFireIfParent=true - Whether the rule should fire if * the event originated from a descendant element. * @param {boolean} settings.bubbleFireIfChildFired=true - Whether the rule should fire * if the same event has already triggered a rule targeting a descendant element. * @param {boolean} settings.bubbleStop=false - Whether the event should not trigger * rules on ancestor elements. * @param {function} trigger - The trigger callback. */ module.exports = function (settings, trigger) { bubbly.addListener(settings, function (syntheticEvent) { var nativeEvent = syntheticEvent.nativeEvent; // AppMeasurement captures the click events, and tries to detect if the element clicked is an A // tag that contains an exit link. When that happens, it stops the initial event, sends a // beacon, clones the initial event and fires it again. // Reactor detects the click events first, because its listeners are set on the capture phase. // We need to ignore the cloned event, otherwise the same rule will fire twice. AppMeasurement // sets `s_fe` attribute on the cloned event, and that is the flag we'll use to ignore these // fake events. // https://git.corp.adobe.com/analytics-platform/appmeasurement/blob/master/bin/js/src/AppMeasurement.js#L3196 if (nativeEvent.s_fe) { return; } var anchorDelay = castToNumberIfString(settings.anchorDelay); if (anchorDelay) { if (!evaluatedEvents.has(nativeEvent)) { var delayableLink = getDelayableLink(nativeEvent); if (delayableLink) { nativeEvent.preventDefault(); setTimeout(function () { window.location = delayableLink.href; }, anchorDelay); } evaluatedEvents.set(nativeEvent, true); } } trigger(syntheticEvent); }); }; /** * @private * Clears all listeners. This should only be used in tests. */ module.exports.__reset = bubbly.__reset; } }, "core/src/lib/events/mediaEnded.js": { "name": "media-ended", "displayName": "Media Ended", "script": function(module, exports, require, turbine) { /*************************************************************************************** * Copyright 2019 Adobe. All rights reserved. * This file is licensed to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. You may obtain a copy * of the License at http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software distributed under * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS * OF ANY KIND, either express or implied. See the License for the specific language * governing permissions and limitations under the License. ****************************************************************************************/ 'use strict'; var bubbly = require('./helpers/createBubbly')(); document.addEventListener('ended', bubbly.evaluateEvent, true); /** * The ended event. This event occurs when playback has stopped because the end of the media was * reached. * @param {Object} settings The event settings object. * @param {string} [settings.elementSelector] The CSS selector the element must match in order for * the rule to fire. * @param {Object[]} [settings.elementProperties] Property values the element must have in order * for the rule to fire. * @param {string} settings.elementProperties[].name The property name. * @param {string} settings.elementProperties[].value The property value. * @param {boolean} [settings.elementProperties[].valueIsRegex=false] Whether value * on the object instance is intended to be a regular expression. * @param {boolean} [settings.bubbleFireIfParent=true] Whether the rule should fire if * the event originated from a descendant element. * @param {boolean} [settings.bubbleFireIfChildFired=true] Whether the rule should fire * if the same event has already triggered a rule targeting a descendant element. * @param {boolean} [settings.bubbleStop=false] Whether the event should not trigger * rules on ancestor elements. * @param {ruleTrigger} trigger The trigger callback. */ module.exports = function (settings, trigger) { bubbly.addListener(settings, trigger); }; } }, "core/src/lib/events/submit.js": { "name": "submit", "displayName": "Submit", "script": function(module, exports, require, turbine) { /*************************************************************************************** * Copyright 2019 Adobe. All rights reserved. * This file is licensed to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. You may obtain a copy * of the License at http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software distributed under * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS * OF ANY KIND, either express or implied. See the License for the specific language * governing permissions and limitations under the License. ****************************************************************************************/ 'use strict'; var bubbly = require('./helpers/createBubbly')(); document.addEventListener('submit', bubbly.evaluateEvent, true); /** * The submit event. This event occurs when an element has lost focus. * @param {Object} settings The event settings object. * @param {string} [settings.elementSelector] The CSS selector the element must match in order for * the rule to fire. * @param {Object[]} [settings.elementProperties] Property values the element must have in order * for the rule to fire. * @param {string} settings.elementProperties[].name The property name. * @param {string} settings.elementProperties[].value The property value. * @param {boolean} [settings.elementProperties[].valueIsRegex=false] Whether value * on the object instance is intended to be a regular expression. * @param {boolean} [settings.bubbleFireIfParent=true] Whether the rule should fire if * the event originated from a descendant element. * @param {boolean} [settings.bubbleFireIfChildFired=true] Whether the rule should fire * if the same event has already triggered a rule targeting a descendant element. * @param {boolean} [settings.bubbleStop=false] Whether the event should not trigger * rules on ancestor elements. * @param {ruleTrigger} trigger The trigger callback. */ module.exports = function (settings, trigger) { bubbly.addListener(settings, trigger); }; } }, "core/src/lib/helpers/getObjectProperty.js": { "script": function(module, exports, require, turbine) { /*************************************************************************************** * Copyright 2019 Adobe. All rights reserved. * This file is licensed to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. You may obtain a copy * of the License at http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software distributed under * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS * OF ANY KIND, either express or implied. See the License for the specific language * governing permissions and limitations under the License. ****************************************************************************************/ 'use strict'; /** * Returns the deep property value of an object. * @param obj The object where the property will be searched. * @param property The property name to be returned. It can contain dots. (eg. prop.subprop1) * @returns {*} */ module.exports = function (obj, property) { var propertyChain = property.split('.'); var currentValue = obj; for (var i = 0, len = propertyChain.length; i < len; i++) { if (currentValue == null) { return undefined; } currentValue = currentValue[propertyChain[i]]; } return currentValue; }; } }, "core/src/lib/events/helpers/pageLifecycleEvents.js": { "script": function(module, exports, require, turbine) { /*************************************************************************************** * (c) 2018 Adobe. All rights reserved. * This file is licensed to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. You may obtain a copy * of the License at http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software distributed under * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS * OF ANY KIND, either express or implied. See the License for the specific language * governing permissions and limitations under the License. ****************************************************************************************/ 'use strict'; // We need to be able to fire the rules in a specific order, no matter if the library is loaded // sync or async. The rules are fired in the following order: // Library loaded rules -> Page bottom rules -> Dom Ready rules -> Window load rules. var window = require('@adobe/reactor-window'); var document = require('@adobe/reactor-document'); var isIE10 = window.navigator.appVersion.indexOf('MSIE 10') !== -1; var WINDOW_LOADED = 'WINDOW_LOADED'; var DOM_READY = 'DOM_READY'; var PAGE_BOTTOM = 'PAGE_BOTTOM'; var lifecycleEventsOrder = [PAGE_BOTTOM, DOM_READY, WINDOW_LOADED]; var createSyntheticEvent = function (element, nativeEvent) { return { element: element, target: element, nativeEvent: nativeEvent }; }; var registry = {}; lifecycleEventsOrder.forEach(function (event) { registry[event] = []; }); var processRegistry = function (lifecycleEvent, nativeEvent) { lifecycleEventsOrder .slice(0, getLifecycleEventIndex(lifecycleEvent) + 1) .forEach(function (lifecycleEvent) { processTriggers(nativeEvent, lifecycleEvent); }); }; var detectLifecycleEvent = function () { if (document.readyState === 'complete') { return WINDOW_LOADED; } else if (document.readyState === 'interactive') { return !isIE10 ? DOM_READY : null; } }; var getLifecycleEventIndex = function (event) { return lifecycleEventsOrder.indexOf(event); }; var processTriggers = function (nativeEvent, lifecycleEvent) { registry[lifecycleEvent].forEach(function (triggerData) { processTrigger(nativeEvent, triggerData); }); registry[lifecycleEvent] = []; }; var processTrigger = function (nativeEvent, triggerData) { var trigger = triggerData.trigger; var syntheticEventFn = triggerData.syntheticEventFn; trigger(syntheticEventFn ? syntheticEventFn(nativeEvent) : null); }; window._satellite = window._satellite || {}; window._satellite.pageBottom = processRegistry.bind(null, PAGE_BOTTOM); document.addEventListener( 'DOMContentLoaded', processRegistry.bind(null, DOM_READY), true ); window.addEventListener( 'load', processRegistry.bind(null, WINDOW_LOADED), true ); // Depending on the way the Launch library was loaded, none of the registered listeners that // execute `processRegistry` may fire . We need to execute the `processRegistry` method at // least once. If this timeout fires before any of the registered listeners, we auto-detect the // current lifecycle event and fire all the registered triggers in order. We don't care if the // `processRegistry` is called multiple times for the same lifecycle event. We fire the registered // triggers for a lifecycle event only once. We used a `setTimeout` here to make sure all the rules // using Library Loaded are registered and executed synchronously and before rules using any of the // other lifecycle event types. window.setTimeout(function () { var lifecycleEvent = detectLifecycleEvent(); if (lifecycleEvent) { processRegistry(lifecycleEvent); } }, 0); module.exports = { registerLibraryLoadedTrigger: function (trigger) { trigger(); }, registerPageBottomTrigger: function (trigger) { registry[PAGE_BOTTOM].push({ trigger: trigger }); }, registerDomReadyTrigger: function (trigger) { registry[DOM_READY].push({ trigger: trigger, syntheticEventFn: createSyntheticEvent.bind(null, document) }); }, registerWindowLoadedTrigger: function (trigger) { registry[WINDOW_LOADED].push({ trigger: trigger, syntheticEventFn: createSyntheticEvent.bind(null, window) }); } }; } }, "core/src/lib/helpers/stringAndNumberUtils.js": { "script": function(module, exports, require, turbine) { 'use strict'; var isNumber = function (value) { return typeof value === 'number' && isFinite(value); // isFinite weeds out NaNs. }; var isString = function (value) { return typeof value === 'string' || value instanceof String; }; var castToStringIfNumber = function (value) { return isNumber(value) ? String(value) : value; }; var castToNumberIfString = function (value) { return isString(value) ? Number(value) : value; }; module.exports = { isNumber: isNumber, isString: isString, castToStringIfNumber: castToStringIfNumber, castToNumberIfString: castToNumberIfString }; } }, "core/src/lib/actions/helpers/decorateCode.js": { "script": function(module, exports, require, turbine) { /* Copyright 2020 Adobe. All rights reserved. This file is licensed to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ 'use strict'; var decorateGlobalJavaScriptCode = require('./decorators/decorateGlobalJavaScriptCode'); var decorateNonGlobalJavaScriptCode = require('./decorators/decorateNonGlobalJavaScriptCode'); var decorateHtmlCode = require('./decorators/decorateHtmlCode'); var decorators = { javascript: function (action, source) { return action.settings.global ? decorateGlobalJavaScriptCode(action, source) : decorateNonGlobalJavaScriptCode(action, source); }, html: decorateHtmlCode }; module.exports = function (action, source) { return decorators[action.settings.language](action, source); }; } }, "core/src/lib/actions/helpers/loadCodeSequentially.js": { "script": function(module, exports, require, turbine) { /*************************************************************************************** * Copyright 2019 Adobe. All rights reserved. * This file is licensed to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. You may obtain a copy * of the License at http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software distributed under * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS * OF ANY KIND, either express or implied. See the License for the specific language * governing permissions and limitations under the License. ****************************************************************************************/ 'use strict'; var Promise = require('@adobe/reactor-promise'); var getSourceByUrl = require('./getSourceByUrl'); var previousExecuteCodePromise = Promise.resolve(); module.exports = function (sourceUrl) { var sequentiallyLoadCodePromise = new Promise(function (resolve) { var loadCodePromise = getSourceByUrl(sourceUrl); Promise.all([loadCodePromise, previousExecuteCodePromise]).then(function ( values ) { var source = values[0]; resolve(source); }); }); previousExecuteCodePromise = sequentiallyLoadCodePromise; return sequentiallyLoadCodePromise; }; } }, "core/node_modules/postscribe/dist/postscribe.js": { "script": function(module, exports, require, turbine) { /** * @file postscribe * @description Asynchronously write javascript, even with document.write. * @version v2.0.8 * @see {@link https://krux.github.io/postscribe} * @license MIT * @author Derek Brans * @copyright 2016 Krux Digital, Inc */ (function webpackUniversalModuleDefinition(root, factory) { if(typeof exports === 'object' && typeof module === 'object') module.exports = factory(); else if(typeof define === 'function' && define.amd) define([], factory); else if(typeof exports === 'object') exports["postscribe"] = factory(); else root["postscribe"] = factory(); })(this, function() { return /******/ (function(modules) { // webpackBootstrap /******/ // The module cache /******/ var installedModules = {}; /******/ /******/ // The require function /******/ function __webpack_require__(moduleId) { /******/ /******/ // Check if module is in cache /******/ if(installedModules[moduleId]) /******/ return installedModules[moduleId].exports; /******/ /******/ // Create a new module (and put it into the cache) /******/ var module = installedModules[moduleId] = { /******/ exports: {}, /******/ id: moduleId, /******/ loaded: false /******/ }; /******/ /******/ // Execute the module function /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); /******/ /******/ // Flag the module as loaded /******/ module.loaded = true; /******/ /******/ // Return the exports of the module /******/ return module.exports; /******/ } /******/ /******/ /******/ // expose the modules object (__webpack_modules__) /******/ __webpack_require__.m = modules; /******/ /******/ // expose the module cache /******/ __webpack_require__.c = installedModules; /******/ /******/ // __webpack_public_path__ /******/ __webpack_require__.p = ""; /******/ /******/ // Load entry module and return exports /******/ return __webpack_require__(0); /******/ }) /************************************************************************/ /******/ ([ /* 0 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; var _postscribe = __webpack_require__(1); var _postscribe2 = _interopRequireDefault(_postscribe); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } module.exports = _postscribe2['default']; /***/ }, /* 1 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; exports.__esModule = true; var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; exports['default'] = postscribe; var _writeStream = __webpack_require__(2); var _writeStream2 = _interopRequireDefault(_writeStream); var _utils = __webpack_require__(4); var utils = _interopRequireWildcard(_utils); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj['default'] = obj; return newObj; } } function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } /** * A function that intentionally does nothing. */ function doNothing() {} /** * Available options and defaults. * * @type {Object} */ var OPTIONS = { /** * Called when an async script has loaded. */ afterAsync: doNothing, /** * Called immediately before removing from the write queue. */ afterDequeue: doNothing, /** * Called sync after a stream's first thread release. */ afterStreamStart: doNothing, /** * Called after writing buffered document.write calls. */ afterWrite: doNothing, /** * Allows disabling the autoFix feature of prescribe */ autoFix: true, /** * Called immediately before adding to the write queue. */ beforeEnqueue: doNothing, /** * Called before writing a token. * * @param {Object} tok The token */ beforeWriteToken: function beforeWriteToken(tok) { return tok; }, /** * Called before writing buffered document.write calls. * * @param {String} str The string */ beforeWrite: function beforeWrite(str) { return str; }, /** * Called when evaluation is finished. */ done: doNothing, /** * Called when a write results in an error. * * @param {Error} e The error */ error: function error(e) { throw new Error(e.msg); }, /** * Whether to let scripts w/ async attribute set fall out of the queue. */ releaseAsync: false }; var nextId = 0; var queue = []; var active = null; function nextStream() { var args = queue.shift(); if (args) { var options = utils.last(args); options.afterDequeue(); args.stream = runStream.apply(undefined, args); options.afterStreamStart(); } } function runStream(el, html, options) { active = new _writeStream2['default'](el, options); // Identify this stream. active.id = nextId++; active.name = options.name || active.id; postscribe.streams[active.name] = active; // Override document.write. var doc = el.ownerDocument; var stash = { close: doc.close, open: doc.open, write: doc.write, writeln: doc.writeln }; function _write(str) { str = options.beforeWrite(str); active.write(str); options.afterWrite(str); } _extends(doc, { close: doNothing, open: doNothing, write: function write() { for (var _len = arguments.length, str = Array(_len), _key = 0; _key < _len; _key++) { str[_key] = arguments[_key]; } return _write(str.join('')); }, writeln: function writeln() { for (var _len2 = arguments.length, str = Array(_len2), _key2 = 0; _key2 < _len2; _key2++) { str[_key2] = arguments[_key2]; } return _write(str.join('') + '\n'); } }); // Override window.onerror var oldOnError = active.win.onerror || doNothing; // This works together with the try/catch around WriteStream::insertScript // In modern browsers, exceptions in tag scripts go directly to top level active.win.onerror = function (msg, url, line) { options.error({ msg: msg + ' - ' + url + ': ' + line }); oldOnError.apply(active.win, [msg, url, line]); }; // Write to the stream active.write(html, function () { // restore document.write _extends(doc, stash); // restore window.onerror active.win.onerror = oldOnError; options.done(); active = null; nextStream(); }); return active; } function postscribe(el, html, options) { if (utils.isFunction(options)) { options = { done: options }; } else if (options === 'clear') { queue = []; active = null; nextId = 0; return; } options = utils.defaults(options, OPTIONS); // id selector if (/^#/.test(el)) { el = window.document.getElementById(el.substr(1)); } else { el = el.jquery ? el[0] : el; } var args = [el, html, options]; el.postscribe = { cancel: function cancel() { if (args.stream) { args.stream.abort(); } else { args[1] = doNothing; } } }; options.beforeEnqueue(args); queue.push(args); if (!active) { nextStream(); } return el.postscribe; } _extends(postscribe, { // Streams by name. streams: {}, // Queue of streams. queue: queue, // Expose internal classes. WriteStream: _writeStream2['default'] }); /***/ }, /* 2 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; exports.__esModule = true; var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; var _prescribe = __webpack_require__(3); var _prescribe2 = _interopRequireDefault(_prescribe); var _utils = __webpack_require__(4); var utils = _interopRequireWildcard(_utils); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj['default'] = obj; return newObj; } } function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } /** * Turn on to debug how each chunk affected the DOM. * @type {boolean} */ var DEBUG_CHUNK = false; /** * Prefix for data attributes on DOM elements. * @type {string} */ var BASEATTR = 'data-ps-'; /** * ID for the style proxy * @type {string} */ var PROXY_STYLE = 'ps-style'; /** * ID for the script proxy * @type {string} */ var PROXY_SCRIPT = 'ps-script'; /** * Get data attributes * * @param {Object} el The DOM element. * @param {String} name The attribute name. * @returns {String} */ function getData(el, name) { var attr = BASEATTR + name; var val = el.getAttribute(attr); // IE 8 returns a number if it's a number return !utils.existy(val) ? val : String(val); } /** * Set data attributes * * @param {Object} el The DOM element. * @param {String} name The attribute name. * @param {null|*} value The attribute value. */ function setData(el, name) { var value = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null; var attr = BASEATTR + name; if (utils.existy(value) && value !== '') { el.setAttribute(attr, value); } else { el.removeAttribute(attr); } } /** * Stream static html to an element, where "static html" denotes "html * without scripts". * * This class maintains a *history of writes devoid of any attributes* or * "proxy history". * * Injecting the proxy history into a temporary div has no side-effects, * other than to create proxy elements for previously written elements. * * Given the `staticHtml` of a new write, a `tempDiv`'s innerHTML is set to * `proxy_history + staticHtml`. * The *structure* of `tempDiv`'s contents, (i.e., the placement of new nodes * beside or inside of proxy elements), reflects the DOM structure that would * have resulted if all writes had been squashed into a single write. * * For each descendent `node` of `tempDiv` whose parentNode is a *proxy*, * `node` is appended to the corresponding *real* element within the DOM. * * Proxy elements are mapped to *actual* elements in the DOM by injecting a * `data-id` attribute into each start tag in `staticHtml`. * */ var WriteStream = function () { /** * Constructor. * * @param {Object} root The root element * @param {?Object} options The options */ function WriteStream(root) { var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; _classCallCheck(this, WriteStream); this.root = root; this.options = options; this.doc = root.ownerDocument; this.win = this.doc.defaultView || this.doc.parentWindow; this.parser = new _prescribe2['default']('', { autoFix: options.autoFix }); // Actual elements by id. this.actuals = [root]; // Embodies the "structure" of what's been written so far, // devoid of attributes. this.proxyHistory = ''; // Create a proxy of the root element. this.proxyRoot = this.doc.createElement(root.nodeName); this.scriptStack = []; this.writeQueue = []; setData(this.proxyRoot, 'proxyof', 0); } /** * Writes the given strings. * * @param {...String} str The strings to write */ WriteStream.prototype.write = function write() { var _writeQueue; (_writeQueue = this.writeQueue).push.apply(_writeQueue, arguments); // Process writes // When new script gets pushed or pending this will stop // because new writeQueue gets pushed while (!this.deferredRemote && this.writeQueue.length) { var arg = this.writeQueue.shift(); if (utils.isFunction(arg)) { this._callFunction(arg); } else { this._writeImpl(arg); } } }; /** * Calls the given function. * * @param {Function} fn The function to call * @private */ WriteStream.prototype._callFunction = function _callFunction(fn) { var tok = { type: 'function', value: fn.name || fn.toString() }; this._onScriptStart(tok); fn.call(this.win, this.doc); this._onScriptDone(tok); }; /** * The write implementation * * @param {String} html The HTML to write. * @private */ WriteStream.prototype._writeImpl = function _writeImpl(html) { this.parser.append(html); var tok = void 0; var script = void 0; var style = void 0; var tokens = []; // stop if we see a script token while ((tok = this.parser.readToken()) && !(script = utils.isScript(tok)) && !(style = utils.isStyle(tok))) { tok = this.options.beforeWriteToken(tok); if (tok) { tokens.push(tok); } } if (tokens.length > 0) { this._writeStaticTokens(tokens); } if (script) { this._handleScriptToken(tok); } if (style) { this._handleStyleToken(tok); } }; /** * Write contiguous non-script tokens (a chunk) * * @param {Array} tokens The tokens * @returns {{tokens, raw, actual, proxy}|null} * @private */ WriteStream.prototype._writeStaticTokens = function _writeStaticTokens(tokens) { var chunk = this._buildChunk(tokens); if (!chunk.actual) { // e.g., no tokens, or a noscript that got ignored return null; } chunk.html = this.proxyHistory + chunk.actual; this.proxyHistory += chunk.proxy; this.proxyRoot.innerHTML = chunk.html; if (DEBUG_CHUNK) { chunk.proxyInnerHTML = this.proxyRoot.innerHTML; } this._walkChunk(); if (DEBUG_CHUNK) { chunk.actualInnerHTML = this.root.innerHTML; } return chunk; }; /** * Build a chunk. * * @param {Array} tokens The tokens to use. * @returns {{tokens: *, raw: string, actual: string, proxy: string}} * @private */ WriteStream.prototype._buildChunk = function _buildChunk(tokens) { var nextId = this.actuals.length; // The raw html of this chunk. var raw = []; // The html to create the nodes in the tokens (with id's injected). var actual = []; // Html that can later be used to proxy the nodes in the tokens. var proxy = []; var len = tokens.length; for (var i = 0; i < len; i++) { var tok = tokens[i]; var tokenRaw = tok.toString(); raw.push(tokenRaw); if (tok.attrs) { // tok.attrs <==> startTag or atomicTag or cursor // Ignore noscript tags. They are atomic, so we don't have to worry about children. if (!/^noscript$/i.test(tok.tagName)) { var id = nextId++; // Actual: inject id attribute: replace '>' at end of start tag with id attribute + '>' actual.push(tokenRaw.replace(/(\/?>)/, ' ' + BASEATTR + 'id=' + id + ' $1')); // Don't proxy scripts: they have no bearing on DOM structure. if (tok.attrs.id !== PROXY_SCRIPT && tok.attrs.id !== PROXY_STYLE) { // Proxy: strip all attributes and inject proxyof attribute proxy.push( // ignore atomic tags (e.g., style): they have no "structural" effect tok.type === 'atomicTag' ? '' : '<' + tok.tagName + ' ' + BASEATTR + 'proxyof=' + id + (tok.unary ? ' />' : '>')); } } } else { // Visit any other type of token // Actual: append. actual.push(tokenRaw); // Proxy: append endTags. Ignore everything else. proxy.push(tok.type === 'endTag' ? tokenRaw : ''); } } return { tokens: tokens, raw: raw.join(''), actual: actual.join(''), proxy: proxy.join('') }; }; /** * Walk the chunks. * * @private */ WriteStream.prototype._walkChunk = function _walkChunk() { var node = void 0; var stack = [this.proxyRoot]; // use shift/unshift so that children are walked in document order while (utils.existy(node = stack.shift())) { var isElement = node.nodeType === 1; var isProxy = isElement && getData(node, 'proxyof'); // Ignore proxies if (!isProxy) { if (isElement) { // New actual element: register it and remove the the id attr. this.actuals[getData(node, 'id')] = node; setData(node, 'id'); } // Is node's parent a proxy? var parentIsProxyOf = node.parentNode && getData(node.parentNode, 'proxyof'); if (parentIsProxyOf) { // Move node under actual parent. this.actuals[parentIsProxyOf].appendChild(node); } } // prepend childNodes to stack stack.unshift.apply(stack, utils.toArray(node.childNodes)); } }; /** * Handles Script tokens * * @param {Object} tok The token */ WriteStream.prototype._handleScriptToken = function _handleScriptToken(tok) { var _this = this; var remainder = this.parser.clear(); if (remainder) { // Write remainder immediately behind this script. this.writeQueue.unshift(remainder); } tok.src = tok.attrs.src || tok.attrs.SRC; tok = this.options.beforeWriteToken(tok); if (!tok) { // User has removed this token return; } if (tok.src && this.scriptStack.length) { // Defer this script until scriptStack is empty. // Assumption 1: This script will not start executing until // scriptStack is empty. this.deferredRemote = tok; } else { this._onScriptStart(tok); } // Put the script node in the DOM. this._writeScriptToken(tok, function () { _this._onScriptDone(tok); }); }; /** * Handles style tokens * * @param {Object} tok The token */ WriteStream.prototype._handleStyleToken = function _handleStyleToken(tok) { var remainder = this.parser.clear(); if (remainder) { // Write remainder immediately behind this style. this.writeQueue.unshift(remainder); } tok.type = tok.attrs.type || tok.attrs.TYPE || 'text/css'; tok = this.options.beforeWriteToken(tok); if (tok) { // Put the style node in the DOM. this._writeStyleToken(tok); } if (remainder) { this.write(); } }; /** * Build a style and insert it into the DOM. * * @param {Object} tok The token */ WriteStream.prototype._writeStyleToken = function _writeStyleToken(tok) { var el = this._buildStyle(tok); this._insertCursor(el, PROXY_STYLE); // Set content if (tok.content) { if (el.styleSheet && !el.sheet) { el.styleSheet.cssText = tok.content; } else { el.appendChild(this.doc.createTextNode(tok.content)); } } }; /** * Build a style element from an atomic style token. * * @param {Object} tok The token * @returns {Element} */ WriteStream.prototype._buildStyle = function _buildStyle(tok) { var el = this.doc.createElement(tok.tagName); el.setAttribute('type', tok.type); // Set attributes utils.eachKey(tok.attrs, function (name, value) { el.setAttribute(name, value); }); return el; }; /** * Append a span to the stream. That span will act as a cursor * (i.e. insertion point) for the element. * * @param {Object} el The element * @param {string} which The type of proxy element */ WriteStream.prototype._insertCursor = function _insertCursor(el, which) { this._writeImpl(''); var cursor = this.doc.getElementById(which); if (cursor) { cursor.parentNode.replaceChild(el, cursor); } }; /** * Called when a script is started. * * @param {Object} tok The token * @private */ WriteStream.prototype._onScriptStart = function _onScriptStart(tok) { tok.outerWrites = this.writeQueue; this.writeQueue = []; this.scriptStack.unshift(tok); }; /** * Called when a script is done. * * @param {Object} tok The token * @private */ WriteStream.prototype._onScriptDone = function _onScriptDone(tok) { // Pop script and check nesting. if (tok !== this.scriptStack[0]) { this.options.error({ msg: 'Bad script nesting or script finished twice' }); return; } this.scriptStack.shift(); // Append outer writes to queue and process them. this.write.apply(this, tok.outerWrites); // Check for pending remote // Assumption 2: if remote_script1 writes remote_script2 then // the we notice remote_script1 finishes before remote_script2 starts. // I think this is equivalent to assumption 1 if (!this.scriptStack.length && this.deferredRemote) { this._onScriptStart(this.deferredRemote); this.deferredRemote = null; } }; /** * Build a script and insert it into the DOM. * Done is called once script has executed. * * @param {Object} tok The token * @param {Function} done The callback when complete */ WriteStream.prototype._writeScriptToken = function _writeScriptToken(tok, done) { var el = this._buildScript(tok); var asyncRelease = this._shouldRelease(el); var afterAsync = this.options.afterAsync; if (tok.src) { // Fix for attribute "SRC" (capitalized). IE does not recognize it. el.src = tok.src; this._scriptLoadHandler(el, !asyncRelease ? function () { done(); afterAsync(); } : afterAsync); } try { this._insertCursor(el, PROXY_SCRIPT); if (!el.src || asyncRelease) { done(); } } catch (e) { this.options.error(e); done(); } }; /** * Build a script element from an atomic script token. * * @param {Object} tok The token * @returns {Element} */ WriteStream.prototype._buildScript = function _buildScript(tok) { var el = this.doc.createElement(tok.tagName); // Set attributes utils.eachKey(tok.attrs, function (name, value) { el.setAttribute(name, value); }); // Set content if (tok.content) { el.text = tok.content; } return el; }; /** * Setup the script load handler on an element. * * @param {Object} el The element * @param {Function} done The callback * @private */ WriteStream.prototype._scriptLoadHandler = function _scriptLoadHandler(el, done) { function cleanup() { el = el.onload = el.onreadystatechange = el.onerror = null; } var error = this.options.error; function success() { cleanup(); if (done != null) { done(); } done = null; } function failure(err) { cleanup(); error(err); if (done != null) { done(); } done = null; } function reattachEventListener(el, evt) { var handler = el['on' + evt]; if (handler != null) { el['_on' + evt] = handler; } } reattachEventListener(el, 'load'); reattachEventListener(el, 'error'); _extends(el, { onload: function onload() { if (el._onload) { try { el._onload.apply(this, Array.prototype.slice.call(arguments, 0)); } catch (err) { failure({ msg: 'onload handler failed ' + err + ' @ ' + el.src }); } } success(); }, onerror: function onerror() { if (el._onerror) { try { el._onerror.apply(this, Array.prototype.slice.call(arguments, 0)); } catch (err) { failure({ msg: 'onerror handler failed ' + err + ' @ ' + el.src }); return; } } failure({ msg: 'remote script failed ' + el.src }); }, onreadystatechange: function onreadystatechange() { if (/^(loaded|complete)$/.test(el.readyState)) { success(); } } }); }; /** * Determines whether to release. * * @param {Object} el The element * @returns {boolean} * @private */ WriteStream.prototype._shouldRelease = function _shouldRelease(el) { var isScript = /^script$/i.test(el.nodeName); return !isScript || !!(this.options.releaseAsync && el.src && el.hasAttribute('async')); }; return WriteStream; }(); exports['default'] = WriteStream; /***/ }, /* 3 */ /***/ function(module, exports, __webpack_require__) { /** * @file prescribe * @description Tiny, forgiving HTML parser * @version vundefined * @see {@link https://github.com/krux/prescribe/} * @license MIT * @author Derek Brans * @copyright 2016 Krux Digital, Inc */ (function webpackUniversalModuleDefinition(root, factory) { if(true) module.exports = factory(); else if(typeof define === 'function' && define.amd) define([], factory); else if(typeof exports === 'object') exports["Prescribe"] = factory(); else root["Prescribe"] = factory(); })(this, function() { return /******/ (function(modules) { // webpackBootstrap /******/ // The module cache /******/ var installedModules = {}; /******/ // The require function /******/ function __webpack_require__(moduleId) { /******/ // Check if module is in cache /******/ if(installedModules[moduleId]) /******/ return installedModules[moduleId].exports; /******/ // Create a new module (and put it into the cache) /******/ var module = installedModules[moduleId] = { /******/ exports: {}, /******/ id: moduleId, /******/ loaded: false /******/ }; /******/ // Execute the module function /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); /******/ // Flag the module as loaded /******/ module.loaded = true; /******/ // Return the exports of the module /******/ return module.exports; /******/ } /******/ // expose the modules object (__webpack_modules__) /******/ __webpack_require__.m = modules; /******/ // expose the module cache /******/ __webpack_require__.c = installedModules; /******/ // __webpack_public_path__ /******/ __webpack_require__.p = ""; /******/ // Load entry module and return exports /******/ return __webpack_require__(0); /******/ }) /************************************************************************/ /******/ ([ /* 0 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; var _HtmlParser = __webpack_require__(1); var _HtmlParser2 = _interopRequireDefault(_HtmlParser); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } module.exports = _HtmlParser2['default']; /***/ }, /* 1 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; exports.__esModule = true; var _supports = __webpack_require__(2); var supports = _interopRequireWildcard(_supports); var _streamReaders = __webpack_require__(3); var streamReaders = _interopRequireWildcard(_streamReaders); var _fixedReadTokenFactory = __webpack_require__(6); var _fixedReadTokenFactory2 = _interopRequireDefault(_fixedReadTokenFactory); var _utils = __webpack_require__(5); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj['default'] = obj; return newObj; } } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } /** * Detection regular expressions. * * Order of detection matters: detection of one can only * succeed if detection of previous didn't * @type {Object} */ var detect = { comment: /^'); if (index >= 0) { return new _tokens.CommentToken(stream.substr(4, index - 1), index + 3); } } /** * Reads non-tag characters. * * @param {string} stream The input stream * @returns {CharsToken} */ function chars(stream) { var index = stream.indexOf('<'); return new _tokens.CharsToken(index >= 0 ? index : stream.length); } /** * Reads start tag token. * * @param {string} stream The input stream * @returns {StartTagToken} */ function startTag(stream) { var endTagIndex = stream.indexOf('>'); if (endTagIndex !== -1) { var match = stream.match(REGEXES.startTag); if (match) { var _ret = function () { var attrs = {}; var booleanAttrs = {}; var rest = match[2]; match[2].replace(REGEXES.attr, function (match, name) { if (!(arguments[2] || arguments[3] || arguments[4] || arguments[5])) { attrs[name] = ''; } else if (arguments[5]) { attrs[arguments[5]] = ''; booleanAttrs[arguments[5]] = true; } else { attrs[name] = arguments[2] || arguments[3] || arguments[4] || REGEXES.fillAttr.test(name) && name || ''; } rest = rest.replace(match, ''); }); return { v: new _tokens.StartTagToken(match[1], match[0].length, attrs, booleanAttrs, !!match[3], rest.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, '')) }; }(); if ((typeof _ret === 'undefined' ? 'undefined' : _typeof(_ret)) === "object") return _ret.v; } } } /** * Reads atomic tag token. * * @param {string} stream The input stream * @returns {AtomicTagToken} */ function atomicTag(stream) { var start = startTag(stream); if (start) { var rest = stream.slice(start.length); // for optimization, we check first just for the end tag if (rest.match(new RegExp('<\/\\s*' + start.tagName + '\\s*>', 'i'))) { // capturing the content is inefficient, so we do it inside the if var match = rest.match(new RegExp('([\\s\\S]*?)<\/\\s*' + start.tagName + '\\s*>', 'i')); if (match) { return new _tokens.AtomicTagToken(start.tagName, match[0].length + start.length, start.attrs, start.booleanAttrs, match[1]); } } } } /** * Reads an end tag token. * * @param {string} stream The input stream * @returns {EndTagToken} */ function endTag(stream) { var match = stream.match(REGEXES.endTag); if (match) { return new _tokens.EndTagToken(match[1], match[0].length); } } /***/ }, /* 4 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; exports.__esModule = true; exports.EndTagToken = exports.AtomicTagToken = exports.StartTagToken = exports.TagToken = exports.CharsToken = exports.CommentToken = exports.Token = undefined; var _utils = __webpack_require__(5); function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } /** * Token is a base class for all token types parsed. Note we don't actually * use intheritance due to IE8's non-existent ES5 support. */ var Token = /** * Constructor. * * @param {string} type The type of the Token. * @param {Number} length The length of the Token text. */ exports.Token = function Token(type, length) { _classCallCheck(this, Token); this.type = type; this.length = length; this.text = ''; }; /** * CommentToken represents comment tags. */ var CommentToken = exports.CommentToken = function () { /** * Constructor. * * @param {string} content The content of the comment * @param {Number} length The length of the Token text. */ function CommentToken(content, length) { _classCallCheck(this, CommentToken); this.type = 'comment'; this.length = length || (content ? content.length : 0); this.text = ''; this.content = content; } CommentToken.prototype.toString = function toString() { return ' 'someArrayReference' currentKey = sanitizeArrayKey(currentKey); var settingsValue = settings[currentKey]; if (Array.isArray(settingsValue)) { settingsValue.forEach(function (arrayEntryObject) { return traverseIntoSettings( remainingPathSegments, arrayEntryObject, decorateWithDynamicHost ); }); } } else { // object case return traverseIntoSettings( remainingPathSegments, settings[currentKey], decorateWithDynamicHost ); } } /** * Returns a function that when called will attempt to traverse the passed in * settings object to each file path and transform a relative URL to an absolute * URL. * * @param isDynamicEnforced * @param decorateWithDynamicHost * @returns {(function(*=, *=, *=): (*))|*} */ var createSettingsFileTransformer$1 = function (isDynamicEnforced, decorateWithDynamicHost) { return function (settings, filePaths, moduleReferencePath) { if ( !isDynamicEnforced || !isPlainObject(settings) || !Object.keys(settings).length || !Array.isArray(filePaths) || !filePaths.length ) { return settings; } // pull out the file paths by the module's reference path and loop over each urlPath filePaths.forEach(function (filePathString) { // The custom code action provides the ability to have the source code in the 'source' // variable or to have an external file. Therefore, this module has 2 behaviors. // It also does not provide a value of false for isExternal just as all other extensions // that use fileTransform do not provide an isExternal variable check. Therefore, we need // to treat Adobe's custom code action special, and don't augment the 'source' variable // if isExternal is not also present. var isAdobeCustomCodeAction = Boolean( moduleReferencePath != null && /^core\/.*actions.*\/customCode\.js$/.test(moduleReferencePath) ); if ( isAdobeCustomCodeAction && filePathString === 'source' && !settings.isExternal ) { return; } // modify the object in place traverseIntoSettings( filePathString.split('.'), settings, decorateWithDynamicHost ); }); return settings; }; }; /*************************************************************************************** * (c) 2017 Adobe. All rights reserved. * This file is licensed to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. You may obtain a copy * of the License at http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software distributed under * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS * OF ANY KIND, either express or implied. See the License for the specific language * governing permissions and limitations under the License. ****************************************************************************************/ // DYNAMIC URL var document$1 = reactorDocument; var objectAssign = reactorObjectAssign; var createDynamicHostResolver = createDynamicHostResolver$1; var buildRuleExecutionOrder = buildRuleExecutionOrder$1; var createDebugController = createDebugController$1; var createExecuteDelegateModule = createExecuteDelegateModule$1; var createGetDataElementValue = createGetDataElementValue$1; var createGetVar = createGetVar$1; var createIsVar = createIsVar$1; var createModuleProvider = createModuleProvider$1; var createNotifyMonitors = createNotifyMonitors$1; var createReplaceTokens = createReplaceTokens$1; var createSetCustomVar = createSetCustomVar$1; var createAddActionToQueue = createAddActionToQueue$1; var createAddConditionToQueue = createAddConditionToQueue$1; var createAddRuleToQueue = createAddRuleToQueue$1; var createEvaluateConditions = createEvaluateConditions$1; var createExecuteRule = createExecuteRule$1; var createGetModuleDisplayNameByRuleComponent = createGetModuleDisplayNameByRuleComponent$1; var createGetSyntheticEventMeta = createGetSyntheticEventMeta$1; var createInitEventModule = createInitEventModule$1; var createLogActionError = createLogActionError$1; var createLogConditionError = createLogConditionError$1; var createLogConditionNotMet = createLogConditionNotMet$1; var createLogRuleCompleted = createLogRuleCompleted$1; var createRunActions = createRunActions$1; var createTriggerRule = createTriggerRule$1; var getRuleComponentErrorMessage = getRuleComponentErrorMessage$1; var isConditionMet = isConditionMet$1; var initRules = initRules$1; var normalizeRuleComponentError = normalizeRuleComponentError$1; var normalizeSyntheticEvent = normalizeSyntheticEvent$1; var getNamespacedStorage = getNamespacedStorage$2; var hydrateModuleProvider = hydrateModuleProvider$1; var hydrateSatelliteObject = hydrateSatelliteObject$1; var createSettingsFileTransformer = createSettingsFileTransformer$1; var logger = logger$8; var _satellite = window._satellite; if (_satellite && !window.__satelliteLoaded) { // If a consumer loads the library multiple times, make sure only the first time is effective. window.__satelliteLoaded = true; var container = _satellite.container; // Remove container in public scope ASAP so it can't be manipulated by extension or user code. delete _satellite.container; /* get rid of container.buildInfo decoration once deprecation is finished of buildInfo.environment string */ var buildInfo = objectAssign({}, container.buildInfo); Object.defineProperty(buildInfo, 'environment', { get: function () { logger.deprecation( 'container.buildInfo.environment is deprecated.' + 'Please use `container.environment.stage` instead' ); return container.environment.stage; } }); container.buildInfo = buildInfo; var localStorage = getNamespacedStorage('localStorage'); var debugController = createDebugController(localStorage, logger); var currentScriptSource = ''; if (document$1.currentScript && document$1.currentScript.getAttribute('src')) { currentScriptSource = document$1.currentScript.getAttribute('src'); } var dynamicHostResolver; try { dynamicHostResolver = createDynamicHostResolver( currentScriptSource, Boolean(container.company.dynamicCdnEnabled), container.company.cdnAllowList, debugController ); } catch (e) { logger.warn('Please review the following error:'); throw e; // We don't want to continue allowing Turbine to start up if we detect an error in here } var settingsFileTransformer = createSettingsFileTransformer( dynamicHostResolver.isDynamicEnforced, dynamicHostResolver.decorateWithDynamicHost ); var moduleProvider = createModuleProvider(); var replaceTokens; var undefinedVarsReturnEmpty = container.property.settings.undefinedVarsReturnEmpty; var ruleComponentSequencingEnabled = container.property.settings.ruleComponentSequencingEnabled; var dataElements = container.dataElements || {}; var getDataElementDefinition = function (name) { return dataElements[name]; }; // We support data elements referencing other data elements. In order to be able to retrieve a // data element value, we need to be able to replace data element tokens inside its settings // object (which is what replaceTokens is for). In order to be able to replace data element // tokens inside a settings object, we need to be able to retrieve data element // values (which is what getDataElementValue is for). This proxy replaceTokens function solves the // chicken-or-the-egg problem by allowing us to provide a replaceTokens function to // getDataElementValue that will stand in place of the real replaceTokens function until it // can be created. This also means that createDataElementValue should not call the proxy // replaceTokens function until after the real replaceTokens has been created. var proxyReplaceTokens = function () { return replaceTokens.apply(null, arguments); }; var getDataElementValue = createGetDataElementValue( moduleProvider, getDataElementDefinition, proxyReplaceTokens, undefinedVarsReturnEmpty, settingsFileTransformer ); var customVars = {}; var setCustomVar = createSetCustomVar(customVars); var isVar = createIsVar(customVars, getDataElementDefinition); var getVar = createGetVar( customVars, getDataElementDefinition, getDataElementValue ); replaceTokens = createReplaceTokens(isVar, getVar, undefinedVarsReturnEmpty); // Important to hydrate satellite object before we hydrate the module provider or init rules. // When we hydrate module provider, we also execute extension code which may be // accessing _satellite. hydrateSatelliteObject( _satellite, container, debugController.setDebugEnabled, getVar, setCustomVar ); hydrateModuleProvider( container, moduleProvider, debugController, replaceTokens, getDataElementValue, settingsFileTransformer, dynamicHostResolver.decorateWithDynamicHost ); var notifyMonitors = createNotifyMonitors(_satellite); var executeDelegateModule = createExecuteDelegateModule( moduleProvider, replaceTokens, settingsFileTransformer ); var getModuleDisplayNameByRuleComponent = createGetModuleDisplayNameByRuleComponent(moduleProvider); var logConditionNotMet = createLogConditionNotMet( getModuleDisplayNameByRuleComponent, logger, notifyMonitors ); var logConditionError = createLogConditionError( getRuleComponentErrorMessage, getModuleDisplayNameByRuleComponent, logger, notifyMonitors ); var logActionError = createLogActionError( getRuleComponentErrorMessage, getModuleDisplayNameByRuleComponent, logger, notifyMonitors ); var logRuleCompleted = createLogRuleCompleted(logger, notifyMonitors); var evaluateConditions = createEvaluateConditions( executeDelegateModule, isConditionMet, logConditionNotMet, logConditionError ); var runActions = createRunActions( executeDelegateModule, logActionError, logRuleCompleted ); var executeRule = createExecuteRule(evaluateConditions, runActions); var addConditionToQueue = createAddConditionToQueue( executeDelegateModule, normalizeRuleComponentError, isConditionMet, logConditionError, logConditionNotMet ); var addActionToQueue = createAddActionToQueue( executeDelegateModule, normalizeRuleComponentError, logActionError ); var addRuleToQueue = createAddRuleToQueue( addConditionToQueue, addActionToQueue, logRuleCompleted ); var triggerRule = createTriggerRule( ruleComponentSequencingEnabled, executeRule, addRuleToQueue, notifyMonitors ); var getSyntheticEventMeta = createGetSyntheticEventMeta(moduleProvider); var initEventModule = createInitEventModule( triggerRule, executeDelegateModule, normalizeSyntheticEvent, getRuleComponentErrorMessage, getSyntheticEventMeta, logger ); initRules(buildRuleExecutionOrder, container.rules || [], initEventModule); } // Rollup's iife option always sets a global with whatever is exported, so we'll set the // _satellite global with the same object it already is (we've only modified it). var src = _satellite; var index = /*@__PURE__*/getDefaultExportFromCjs(src); return index; })(); } //Change name later bactm.on('plugins:OneTrust:C0002:AdobeSensei', handleAlloy); } } catch(e){ utag.DB(e) } }]; u.send = function(a, b) { if (u.ev[a] || u.ev.all !== undefined) { //##UTENABLEDEBUG##utag.DB("send:##UTID##"); var c, d, e, f, i; u.data = { /* Initialize default tag parameter values here */ /* Examples: */ /* "account_id" : "1234567" */ /* "base_url" : "//insert.your.javascript.library.url.here.js" */ /* A value mapped to "account_id" or "base_url" in TiQ will replace these default values. */ }; /* Start Tag-Scoped Extensions Code */ /* Please Do Not Edit This Section */ for(c=0;c